Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lowering XLA clamp instruction to cuDNN. #13020

Closed
wants to merge 1 commit into from

Conversation

elfiegg
Copy link
Contributor

@elfiegg elfiegg commented May 23, 2024

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev

@github-actions github-actions bot added the kokoro:force-run Forces CI to rerun label May 23, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Forces CI to rerun label May 23, 2024
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 636814740
copybara-service bot pushed a commit that referenced this pull request May 24, 2024
Overall the idea is to collect profile data for each module given amount of times (which can be configured) then recompile the module with the aggregated profile data.

1. We need to track how many times each module were profiled and collect profiling results. For this i added a ProfileSessionRunner class at profile.py. The class can track how many times an instance of it was called to profile a session and also can aggregate profile results.

2. We need associate profiling session to the module at the interpreter. To do this i added a dictionary to pjit.py which associates Jaxpr with profile session runner.

3. The profile session runner should be passed to pxla.py and then called.

4. We need to correctly deal with fast path at the interpreter level, so JAX won't use HLO directly if PGLE need to be collected, but also JAX will not recompiled the module only for PGLE. See changes in pjit.py and in lru_cache.h

5. Once FDO is collected we need to share it between hosts to keep deterministic compilation.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#13020 from elfiegg:fp8_triton 47dc71f
PiperOrigin-RevId: 617824989
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Imported from GitHub PR openxla/xla#13020

Support lowering XLA clamp instruction to cuDNN.
cc @sergachev
Copybara import of the project:

--
47dc71f2a0d5887461a0b7d985328442e0e8da2f by Elfie Guo <elfieg@nvidia.com>:

Support lowering clamp instruction to cuDNN.

Merging this change closes #13020

PiperOrigin-RevId: 636875273
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 24, 2024
Overall the idea is to collect profile data for each module given amount of times (which can be configured) then recompile the module with the aggregated profile data.

1. We need to track how many times each module were profiled and collect profiling results. For this i added a ProfileSessionRunner class at profile.py. The class can track how many times an instance of it was called to profile a session and also can aggregate profile results.

2. We need associate profiling session to the module at the interpreter. To do this i added a dictionary to pjit.py which associates Jaxpr with profile session runner.

3. The profile session runner should be passed to pxla.py and then called.

4. We need to correctly deal with fast path at the interpreter level, so JAX won't use HLO directly if PGLE need to be collected, but also JAX will not recompiled the module only for PGLE. See changes in pjit.py and in lru_cache.h

5. Once FDO is collected we need to share it between hosts to keep deterministic compilation.

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13020 from elfiegg:fp8_triton 47dc71f2a0d5887461a0b7d985328442e0e8da2f
PiperOrigin-RevId: 617824989
@sergeykozub
Copy link
Contributor

This PR results in "Unsupported elementwise operation %clamp.1" in an internal test, which is raised in "ir_emitter_triton.cc"
I'll roll back and look into this on Monday.

Copy link

This PR was rolled back in d114ece!

@elfiegg
Copy link
Contributor Author

elfiegg commented May 24, 2024

sent https://github.com/openxla/xla/pull/13061/files, can you help verify if this fixes the test?

@akuegel
Copy link
Member

akuegel commented May 28, 2024

Confirmed, this fixed the test, and we have rolled this PR forward again.

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.

None yet

6 participants