Skip to content

[Engine] AVX CPU not working and a possible solution #4165

Open

Description

@FlowDownTheRiver

Hi there. thanks for the project.
I am using intel I7 3930k processor with AVX instructions only,64 GB drr3 ram,paired with RTX 3090.
Just because I was having trouble with the pre-compiled strata engine and vision exe files and I was also getting errors with the official repo compling,I asked claude to give me a solution. and it gave me a working solution so that I am able to compile the strata.exe and strata_vision.exe files. However my Strata is pulling your latest repository with bat files and old GUI.(older way of using strata). So when I realized you have changed the repo to a new setup format,there is no way for me to compile the strata engine for the new user interface. I used my old setup and compiled the exe files with bat files and it is working on the old strata(cuda 12),however this new GUI is forcing to use cuda13 in this folder : C:\Users\my_user_name\AppData\Local\Strata\components\engine\0.1.50-windows-x86_64-cuda-cuda13. I tried to compile the exe on old strata and replace the exe files,it didn't work, I downloaded your cuda12 pack and manually put them in the app data folder it didn't work either because they are compiled with avx2 and also the new gui deleted the files and replaced them with cuda 13 again. So in short I don't have avx2 cpu to use the new GUI.

in my old setup to make it work I am using this to compile and update with bat files and a supplementary monkey patch python file to patch the cmake file which can compile the exe without any errors for the avx cpus :

python patch file as patch_strata.py :

#!/usr/bin/env python3
"""Re-apply local build fixes to a fresh Strata checkout. Safe to run any number of times.

Usage: python patch_strata.py [--restore] [path\to\Strata] (default: the folder this script sits in, else cwd)

(no flag) apply every patch below that is still needed
--restore undo them with "git checkout -- " so the next "git pull" cannot be blocked by local edits

Patch 1 - CMakeLists.txt, MSVC + CUDA 12.x link error (LNK2005 / LNK1169, "cudart_static.lib ... already defined in
cudart.lib"): upstream only links the shared CUDA runtime when STRATA_EXPERIMENTAL_SM60 is set. This makes
it apply to every MSVC build except the STRATA_PORTABLE release build.
Patch 2 - src/core/vmm.cpp, compile error C3861 "cudaGetDriverEntryPointByVersion: identifier not found" with
CUDA 12.4 (that function arrived in CUDA 12.5). Uses the same #if CUDART_VERSION guard that
src/core/expert_cache.cpp already has.
The AVX (no-AVX2) support itself is upstream (STRATA_ISA_FLOOR=avx), so it needs no patch.
"""
import re, subprocess, sys
from pathlib import Path

MARK = "STRATA-LOCAL-PATCH"

--------------------------------------------------------------------------------------------- patch 1: CMake

_CM_OLD = re.compile(r"if(MSVC AND STRATA_EXPERIMENTAL_SM60 AND NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY)")
_CM_NEW = "if(MSVC AND NOT STRATA_PORTABLE AND NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY) # " + MARK
_ENABLE = re.compile(r"^(?P[ \t])enable_language(CUDA)[ \t](?P\r?\n)", re.M)

def patch_cmake(txt):
"""returns (new_text or None, message)"""
if MARK in txt:
return None, "already patched"
if _CM_OLD.search(txt):
return _CM_OLD.sub(_CM_NEW, txt, count=1), "patched"
if re.search(r"if(MSVC[^\n]*CMAKE_CUDA_RUNTIME_LIBRARY", txt) and "Shared" in txt:
return None, "upstream already links the shared runtime for this build - nothing to do"
m = _ENABLE.search(txt)
if not m:
return None, "FAILED: neither the known block nor enable_language(CUDA) found - edit by hand"
i, nl = m.group("ind"), m.group("nl")
block = (f"{i}if(MSVC AND NOT STRATA_PORTABLE AND NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY) # {MARK}{nl}"
f"{i} set(CMAKE_CUDA_RUNTIME_LIBRARY Shared){nl}{i}endif(){nl}")
return txt[:m.start()] + block + txt[m.start():], "patched (fallback insert)"

---------------------------------------------------------------------------------------------- patch 2: vmm

_VMM_OLD = re.compile(
r"(?P[ \t])if (cudaGetDriverEntryPointByVersion(name, &p, 12000, cudaEnableDefault, &q) != cudaSuccess ||"
r"\s
q != cudaDriverEntryPointSuccess || p == nullptr)\s*return false;")

def patch_vmm(txt):
if MARK in txt:
return None, "already patched"
if "cudaGetDriverEntryPointByVersion" not in txt:
return None, "no cudaGetDriverEntryPointByVersion call any more - nothing to do"
if "CUDART_VERSION" in txt:
return None, "upstream already guards it with CUDART_VERSION - nothing to do"
m = _VMM_OLD.search(txt)
if not m:
return None, ("FAILED: cudaGetDriverEntryPointByVersion is used but the code changed shape - guard it by hand "
"like src/core/expert_cache.cpp does (#if CUDART_VERSION >= 12050 ... #else cudaGetDriverEntryPoint)")
nl = "\r\n" if "\r\n" in txt else "\n"
i = m.group("ind")
new = nl.join([
f"#if CUDART_VERSION >= 12050 // {MARK}: cudaGetDriverEntryPointByVersion needs CUDA 12.5+",
f"{i}const cudaError_t e = cudaGetDriverEntryPointByVersion(name, &p, 12000, cudaEnableDefault, &q);",
"#else",
f"{i}const cudaError_t e = cudaGetDriverEntryPoint(name, &p, cudaEnableDefault, &q);",
"#endif",
f"{i}if (e != cudaSuccess || q != cudaDriverEntryPointSuccess || p == nullptr) {{",
f"{i} (void) cudaGetLastError();",
f"{i} return false;",
f"{i}}}",
])
return txt[:m.start()] + new + txt[m.end():], "patched"

PATCHES = [("CMakeLists.txt", patch_cmake), ("src/core/vmm.cpp", patch_vmm)]

------------------------------------------------------------------------------------------------------ driver

def apply_all(root: Path) -> None:
for rel, fn in PATCHES:
f = root / rel
if not f.exists():
print(f"{rel}: not present - skipped")
continue
txt = f.read_bytes().decode("utf-8") # keeps BOM and CRLF exactly as they are
new, msg = fn(txt)
if new is not None:
f.write_bytes(new.encode("utf-8"))
print(f"{rel}: {msg}")

def restore_all(root: Path) -> None:
if not (root / ".git").exists():
print("not a git clone - nothing to restore")
return
for rel, _ in PATCHES:
r = subprocess.run(["git", "-C", str(root), "checkout", "--", rel], capture_output=True, text=True)
print(f"{rel}: {'restored to the repo version' if r.returncode == 0 else 'left alone (' + r.stderr.strip()[:80] + ')'}")

if name == "main":
args = [a for a in sys.argv[1:] if not a.startswith("--")]
here = Path(file).resolve().parent
root = Path(args[0]) if args else (here if (here / "CMakeLists.txt").exists() else Path.cwd())
if not (root / "CMakeLists.txt").exists():
sys.exit(f"no CMakeLists.txt in {root}")
(restore_all if "--restore" in sys.argv else apply_all)(root)

CMakeLists.txt

my custom update bat file as UPDATE_custom.bat(uses monkey patching with the python code provided) :

@echo off
rem Update Strata without starting the model (#475): the newest code (git pull, when this folder is a git clone), then
rem what START-HERE.bat does before a start - the engine (a new one when this version needs it), the Python packages,
rem each installed model's settings and draft subset. The model files are not touched. Start the model later with
rem START-HERE.bat. Options are passed on to setup.py.
setlocal
title Strata - update
cd /d "%~dp0"
rem All of it in one block: cmd reads a .bat file while it runs it, and the git pull can change this very file.
(
if exist ".git" (
where git >nul 2>nul || (
echo This folder is a git clone, but git is not on PATH: install Git for Windows ^(winget install Git.Git^)
echo or run "git pull" here yourself, then run UPDATE.bat again.
pause
exit /b 1
)
rem drop the local build patches first - otherwise git pull refuses when upstream changed a patched file
if exist "%~dp0patch_strata.py" (
where python >nul 2>nul
if errorlevel 1 (
py -3 "%~dp0patch_strata.py" --restore "%~dp0." >nul 2>nul
) else (
python "%~dp0patch_strata.py" --restore "%~dp0." >nul 2>nul
)
)
git checkout -- CMakeLists.txt >nul 2>nul
git checkout -- src/core/vmm.cpp >nul 2>nul
echo Getting the newest Strata ^(git pull^) ...
git pull --ff-only || (
echo.
echo git pull did not succeed ^(the reason is above^).
git rev-parse --abbrev-ref --symbolic-full-name @{u} >nul 2>nul || (
echo This branch has no upstream set - nothing was updated.
pause
exit /b 1
)
echo "Not possible to fast-forward" means upstream rewrote its history ^(a forced update^).
echo This copy can be reset to the newest upstream. Commits made only in this copy, and edits to tracked
echo files, would be lost ^(your patch and bat files are not tracked, so they stay^).
for /f %%h in ('git rev-parse --short HEAD') do echo Current commit is %%h - "git reset --hard %%h" brings it back.
choice /c YN /m " Reset this copy to the newest upstream now"
if errorlevel 2 (
echo Nothing was updated.
pause
exit /b 1
)
git reset --hard @{u} || (
echo The reset failed - nothing was updated.
pause
exit /b 1
)
)
) else (
echo This copy of Strata was not made with git, so it cannot fetch new files itself. Download the newest one:
echo https://github.com/Niko1221/Strata/archive/refs/heads/main.zip
echo unzip it anywhere and run START-HERE.bat ^(or UPDATE.bat^) in it: it finds the model files in Strata-data
echo and sets itself up the same way - nothing big is downloaded again.
echo Checking this copy's engine and settings meanwhile ...
)
if exist "%~dp0patch_strata.py" (
echo Applying local build patches ^(patch_strata.py^) ...
where python >nul 2>nul
if errorlevel 1 (
py -3 "%~dp0patch_strata.py" "%~dp0." || echo python not found - continuing without the patch
) else (
python "%~dp0patch_strata.py" "%~dp0."
)
)
call "%~dp0START-HERE.bat" --update %*
if not errorlevel 1 pause
exit /b
)


Anyway,with these I am able to use the old strata with bat files,but I want to use the new GUI of strata which needs to work with avx cpus. Can you please use these files or examine them to make the new GUI work with AVX cpu's with cuda 12 or cuda 13, whichever is suitable?

Activity

  1. coolguy744-creator commented on Oct 26, 2026

    @coolguy744-creator

    What a strange composition of parts you have.

    What is this mobo that can run a 3090 and is stuck to ddr3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions