Skip to content

Skip stale entries in the DSL shared library list - #3484

Open
VaggelisGian wants to merge 1 commit into
NVIDIA:mainfrom
VaggelisGian:fix-dsl-skip-missing-shared-libs
Open

Skip stale entries in the DSL shared library list#3484
VaggelisGian wants to merge 1 commit into
NVIDIA:mainfrom
VaggelisGian:fix-dsl-skip-missing-shared-libs

Conversation

@VaggelisGian

Copy link
Copy Markdown

Fixes #3462 (part 2: worker-side hard failure)

get_shared_libs raised FileNotFoundError on the first missing entry of the colon-separated {prefix}_LIBS list. The list travels inside job environments (Slurm sbatch defaults to --export=ALL), so a worker can receive an entry pointing into the submitter's site-packages, and every compile died on it even though another entry named a usable local runtime.

This skips entries whose file does not exist on this machine and warns about them instead. It keeps raising when nothing in the list survives, since that means there is no usable runtime at all and the compile cannot proceed.

Part 1 of the issue (the import-time CUTE_DSL_LIBS mutation that manufactures these stale entries) is a separate mechanism in a separate file and is intentionally not bundled here.

Adds test/python/CuTeDSL/test_shared_libs.py (3 CPU-only tests using a stubbed DSL instance).

Test Plan:

$ docker run --rm python:3.12-slim ...   # editable install of python/CuTeDSL
$ CUTE_DSL_LIBS=/nonexistent/libcute_dsl_runtime.so:<valid cu12/lib/libcute_dsl_runtime.so> \
    python -c "<compile a trivial @cute.jit function>"
  unfixed: FileNotFoundError: [Errno 2] No such file or directory:
           '/nonexistent/libcute_dsl_runtime.so'
  fixed:   UserWarning: Skipping /nonexistent/libcute_dsl_runtime.so ... other
           entries ... point at a usable runtime.
           COMPILE_OK

$ CUTE_DSL_LIBS=/nonexistent/a.so:/nonexistent/b.so ...
  fixed:   FileNotFoundError: [Errno 2] No such file or directory:
           '/nonexistent/a.so:/nonexistent/b.so'

$ python test/python/CuTeDSL/test_shared_libs.py -v
  Ran 3 tests ... OK   (the mixed-entry test fails on unfixed code)

Known same-class gaps left out of scope: cutlass/jax/ffi.py::find_cute_dsl_runtime_library and tvm_ffi_provider.py still return the first name-matching entry without an existence check.

get_shared_libs raised FileNotFoundError on the first missing entry of
the colon-separated {prefix}_LIBS list. The list travels inside job
environments (Slurm sbatch defaults to --export=ALL), so a worker could
receive an entry pointing into the submitter's site-packages and every
compile died on it even though another entry named a usable local
runtime.

Skip entries whose file does not exist on this machine and warn about
them instead. Keep raising when nothing in the list survives, since
that means there is no usable runtime at all and the compile cannot
proceed.

Add test/python/CuTeDSL/test_shared_libs.py covering the mixed,
all-missing and unset cases.

Test Plan:
  docker python:3.12-slim, editable install of python/CuTeDSL:
    CUTE_DSL_LIBS=<stale>:<valid cu12/lib/libcute_dsl_runtime.so>
      unfixed: FileNotFoundError: /nonexistent/libcute_dsl_runtime.so
      fixed: warning + COMPILE_OK
    CUTE_DSL_LIBS=<stale1>:<stale2>
      fixed: FileNotFoundError naming the full list
    python test/python/CuTeDSL/test_shared_libs.py -v:
      Ran 3 tests ... OK (skip test fails on unfixed code)
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.

[BUG] CuTe DSL 4.7.0: import-time CUTE_DSL_LIBS env write breaks Slurm jobs on other machines

1 participant