fix(cuda): make GEMM caches safe for threaded callers#631
Open
voltjia wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #627.
Operator::Callcache storage thread-local, with an atomic generation counter for cache invalidation.CUBLAS_COMPUTE_32Ffor NVIDIA GEMM compute type to avoid fp32 TF32 differences.Operator::Callcalls and update GEMM tests to compare against strict fp32 PyTorch reference behavior.Validation
Remote NVIDIA host, container
infiniops-ci/nvidia:latest:git diff --check python3 scripts/generate_torch_ops.py python3 -m pip install --no-build-isolation --no-deps . \ --config-settings=cmake.define.AUTO_DETECT_DEVICES=OFF \ --config-settings=cmake.define.AUTO_DETECT_BACKENDS=OFF \ --config-settings=cmake.define.WITH_CPU=ON \ --config-settings=cmake.define.WITH_NVIDIA=ON INFINIOPS_INSTALL_PREFIX=/usr/local \ python3 -m pytest -q tests/test_cpp_api.py tests/test_gemm.py --devices nvidiaResult:
2000 passed, 1001 skipped in 9.08s.Also ran:
Result:
2 files already formatted;All checks passed.A prior
WITH_TORCH=ONfocused run built successfully, then failed GEMM comparisons because PyTorch reference GEMM was still using TF32 while this PR switches native NVIDIA GEMM to strict fp32. The GEMM test now disables PyTorch TF32 in the module reference path for parity with the new behavior.