fix: patch EXLA Makefile directly for -O0 and -j1 in CI image
elixir_make builds a sanitized env map for make — MAKEFLAGS and DEBUG never reach make. EXLA also sets make_args to nproc-2 parallel jobs. We must patch the Makefile (-O3→-O0) and override make_args via Application.put_env to actually control compilation behavior.
This commit is contained in:
parent
484c59f217
commit
07dbcbc428
1 changed files with 8 additions and 5 deletions
|
|
@ -34,11 +34,14 @@ COPY vendor /tmp/exla_warm/vendor
|
|||
RUN mkdir -p /tmp/exla_warm/config && \
|
||||
printf 'import Config\nconfig :nx, :default_backend, EXLA.Backend\n' > /tmp/exla_warm/config/config.exs
|
||||
|
||||
# Compile all deps. DEBUG=1 tells the EXLA Makefile to use -g instead
|
||||
# of -O3 — this avoids the heavy optimization passes that OOM-kill g++
|
||||
# on low-memory CI runners. MAKEFLAGS=-j1 serializes make jobs. The
|
||||
# resulting unoptimized NIF is fine for tests.
|
||||
RUN MAKEFLAGS="-j1" DEBUG=1 mix deps.get && MAKEFLAGS="-j1" DEBUG=1 mix deps.compile
|
||||
# Compile all deps. EXLA's Makefile defaults to -O3 which OOM-kills g++
|
||||
# on low-memory CI runners. Patch it to -O0 before compilation.
|
||||
# Also override make_args to -j1 (EXLA defaults to nproc-2 parallel jobs)
|
||||
# since elixir_make's sanitized env blocks MAKEFLAGS/DEBUG from reaching make.
|
||||
RUN mix deps.get && \
|
||||
sed -i 's/-O3/-O0/g' deps/exla/Makefile && \
|
||||
mix run -e 'Application.put_env(:exla, :make_args, ["-j1"])' && \
|
||||
mix deps.compile
|
||||
|
||||
# Save the full build cache (libexla.so + .o files + xla_extension lib)
|
||||
# so Make finds all targets already built when restored in the test step.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue