forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify loading of precompiled GPU kernels in tests
We have quite a few tests that load kernels via `MultiKernelLoaderSpec`. Most of these tests load a kernel using `AddCudaPtxInMemory` from an embedded PTX string. The same is not possible for ROCm because there is no equivalent abstraction layer to PTX. So for ROCm we load an embedded precompiled HSACO (fat) binary using `AddCudaCubinInMemory` and litter the tests with preprocessor conditionals that call either the former or the latter depending on the enabled GPU backend. This change unifies both approaches by introducing a genrule that can extract a CUDA or ROCm fat binary from a `gpu_kernel_library` target. Concretely it does the following: 1. Create new target `:gpu_test_kernels_fatbin` which complements `:gpu_test_kernels` and provides the same kernels as a fat binary (CUBIN/HSACO) in memory. 2. Extend `gpu_kernel_test` so that it test all kernel loading APIs `AddCudaPtxInMemory`, `AddCudaCubinInMemory`, `AddInProcessSymbol` in the same way. 3. Use `AddCudaCubinInMemory` for all the runtime tests which now can share the same code between CUDA and ROCm. 4. Use the correct kernels names `AddI32` and `MulI32` in all tests (this matters since we don't load from PTX anymore and there is a lookup by name.) 5. Remove the old ROCm only kernel embedding approach which only worked for ROCm. PiperOrigin-RevId: 664681229
- Loading branch information
1 parent
a6b5bdb
commit 5046013
Showing
12 changed files
with
286 additions
and
220 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.