Skip to content

Fat binary: add MGONGPU_SIMD_LEVEL env-var to override runtime SIMD selection#1087

Open
Copilot wants to merge 4 commits intomasterfrom
copilot/add-fat-binary-support-simd
Open

Fat binary: add MGONGPU_SIMD_LEVEL env-var to override runtime SIMD selection#1087
Copilot wants to merge 4 commits intomasterfrom
copilot/add-fat-binary-support-simd

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 14, 2026

The fat binary always auto-selects the highest SIMD tier the CPU supports, with no way to force a lower level at runtime. This makes it impossible to benchmark, e.g., AVX2 vs AVX512 on the same machine without recompiling.

Changes

  • MatrixElementKernels.cc (CODEGEN template)detectBestSimd() now reads MGONGPU_SIMD_LEVEL before falling through to __builtin_cpu_supports() auto-detection:
    • Accepted values: avx512z, avx512y, avx2, sse4, none
    • If the requested level is unsupported by the hardware a WARNING is printed and auto-detection proceeds (prevents SIGILL)
    • Unrecognised values also fall back to auto-detection with a WARNING
    • No-op when unset
# Compare SIMD tiers on one machine without recompiling
MGONGPU_SIMD_LEVEL=avx512z ./check_cpp.exe -p 65536 1 32
MGONGPU_SIMD_LEVEL=avx2    ./check_cpp.exe -p 65536 1 32
MGONGPU_SIMD_LEVEL=sse4    ./check_cpp.exe -p 65536 1 32

Copilot AI and others added 4 commits April 13, 2026 19:04
…stFat, cppfat backend, build rules

Agent-Logs-Url: https://github.com/madgraph5/madgraph4gpu/sessions/db0d537e-e75b-4d0b-ba4c-b7f11fb41df6

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
…d Parameters_sm per-SIMD compilation, CPPProcess_base_cpp.o

Agent-Logs-Url: https://github.com/madgraph5/madgraph4gpu/sessions/db0d537e-e75b-4d0b-ba4c-b7f11fb41df6

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
…nGpuConfig.h

Agent-Logs-Url: https://github.com/madgraph5/madgraph4gpu/sessions/db0d537e-e75b-4d0b-ba4c-b7f11fb41df6

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
…election

Agent-Logs-Url: https://github.com/madgraph5/madgraph4gpu/sessions/0bd7a4a4-bb24-4bbf-b578-58747cf4f9fa

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants