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

Add SYCL build script #11767

Closed
wants to merge 2 commits into from
Closed

Conversation

ShengYang1
Copy link
Contributor

@ShengYang1 ShengYang1 commented Apr 23, 2024

This is a sub PR of #9042, it adds a script to build xla with --config=sycl.
Here is how to use:

workspace=$1
xla_path=$workspace/xla
cd $workspace
git clone -b yang/ci https://github.com/Intel-tensorflow/xla xla
bash $xla_path/build_tools/sycl/build.sh $workspace

@Zantares
Copy link

Hi @penpornk , any OpenXLA developer can use this script to check SYCL backend build if needed. It will automatically download the build environment including the necessary toolchain/lib, and clear it after build is done.

@kamaljeeti
Copy link
Contributor

Hi @penpornk , can you please look into this? Thanks.

@penpornk penpornk requested a review from ddunl May 7, 2024 12:08
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally convinced that this should be separate from the build_tools/sycl dir. Do you have a strong preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm not sure where should I put all these scripts. I'll move this file to build_tools/sycl if this is fine.

@github-actions github-actions bot added the kokoro:force-run Forces CI to rerun label May 8, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Forces CI to rerun label May 8, 2024
@penpornk
Copy link
Member

@ddunl Does the new file path look good to you?

copybara-service bot pushed a commit that referenced this pull request May 17, 2024
Imported from GitHub PR #11767

This is a sub PR of #9042, it adds a script to build xla with `--config=sycl`.
Here is how to use:
```bash
workspace=$1
xla_path=$workspace/xla
cd $workspace
git clone -b yang/ci https://github.com/Intel-tensorflow/xla xla
bash $xla_path/build_tools/sycl/build.sh $workspace
```
Copybara import of the project:

--
d811bba by Sheng, Yang <[email protected]>:

Add SYCL build script

--
0c2500b by Sheng, Yang <[email protected]>:

change path

Merging this change closes #11767

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11767 from Intel-tensorflow:yang/ci 0c2500b
PiperOrigin-RevId: 634661773
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
Imported from GitHub PR openxla/xla#11767

This is a sub PR of openxla/xla#9042, it adds a script to build xla with `--config=sycl`.
Here is how to use:
```bash
workspace=$1
xla_path=$workspace/xla
cd $workspace
git clone -b yang/ci https://github.com/Intel-tensorflow/xla xla
bash $xla_path/build_tools/sycl/build.sh $workspace
```
Copybara import of the project:

--
d811bba1548f0c983da473a0940b1ea3d8b2c436 by Sheng, Yang <[email protected]>:

Add SYCL build script

--
0c2500b703b73bc340ccc9e3817c7ce54cc8d718 by Sheng, Yang <[email protected]>:

change path

Merging this change closes #11767

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 634661773
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
Imported from GitHub PR openxla/xla#11767

This is a sub PR of openxla/xla#9042, it adds a script to build xla with `--config=sycl`.
Here is how to use:
```bash
workspace=$1
xla_path=$workspace/xla
cd $workspace
git clone -b yang/ci https://github.com/Intel-tensorflow/xla xla
bash $xla_path/build_tools/sycl/build.sh $workspace
```
Copybara import of the project:

--
d811bba1548f0c983da473a0940b1ea3d8b2c436 by Sheng, Yang <[email protected]>:

Add SYCL build script

--
0c2500b703b73bc340ccc9e3817c7ce54cc8d718 by Sheng, Yang <[email protected]>:

change path

Merging this change closes #11767

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 634661773
copybara-service bot pushed a commit that referenced this pull request May 17, 2024
- Adding namespace to `string` -> `std::string` (Not sure why this compiled in the first place)
- Remove unused local variables
- Avoid unintended fallthrough in switch statement
- Fix member variable initialization order in a constructor
- Avoid read of unintialized variable

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11767 from Intel-tensorflow:yang/ci 0c2500b
PiperOrigin-RevId: 634669250
copybara-service bot pushed a commit that referenced this pull request May 17, 2024
A recent Triton integrate broke the ROCm
code path of our Triton emitter.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11767 from Intel-tensorflow:yang/ci 0c2500b
PiperOrigin-RevId: 634677074
copybara-service bot pushed a commit that referenced this pull request May 17, 2024
FUTURE_COPYBARA_INTEGRATE_REVIEW=#11767 from Intel-tensorflow:yang/ci 0c2500b
PiperOrigin-RevId: 633412483
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
- Adding namespace to `string` -> `std::string` (Not sure why this compiled in the first place)
- Remove unused local variables
- Avoid unintended fallthrough in switch statement
- Fix member variable initialization order in a constructor
- Avoid read of unintialized variable

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 634669250
copybara-service bot pushed a commit that referenced this pull request May 17, 2024
A recent Triton integrate broke the ROCm
code path of our Triton emitter.

The values of the new pass parameters has been derived from the upstream change: triton-lang/triton@99fb876#diff-33c9a103282c05c9d9d213b94450ae7481b6db8c3c6d810f54f175b4735a3c72

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11767 from Intel-tensorflow:yang/ci 0c2500b
PiperOrigin-RevId: 634677074
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 633412483
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
A recent Triton integrate broke the ROCm
code path of our Triton emitter.

The values of the new pass parameters has been derived from the upstream change: triton-lang/triton@99fb876#diff-33c9a103282c05c9d9d213b94450ae7481b6db8c3c6d810f54f175b4735a3c72

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 634677074
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
Imported from GitHub PR openxla/xla#11767

This is a sub PR of openxla/xla#9042, it adds a script to build xla with `--config=sycl`.
Here is how to use:
```bash
workspace=$1
xla_path=$workspace/xla
cd $workspace
git clone -b yang/ci https://github.com/Intel-tensorflow/xla xla
bash $xla_path/build_tools/sycl/build.sh $workspace
```
Copybara import of the project:

--
d811bba1548f0c983da473a0940b1ea3d8b2c436 by Sheng, Yang <[email protected]>:

Add SYCL build script

--
0c2500b703b73bc340ccc9e3817c7ce54cc8d718 by Sheng, Yang <[email protected]>:

change path

Merging this change closes #11767

PiperOrigin-RevId: 634676627
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request May 17, 2024
…ly).

So far, we guard the dep with `#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM` and return an unimplemented error otherwise. However, having `"triton"` in the build graph makes no sense if neither CUDA nor ROCm toolkits are available at build time. This PR moves the `if_gpu_is_configured` branching upwards in the build graph to `"ir_emitter_unnested`".

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11767 from Intel-tensorflow:yang/ci 0c2500b703b73bc340ccc9e3817c7ce54cc8d718
PiperOrigin-RevId: 634338739
@abhaskumarsinha
Copy link

Unrelated,

I'm a bit confused about how XLA Backend works, glad you all are working with the SYCL backend. Can you please point out where sycl_compiler.cc exists? Like for NVIDIA this file nvptx_compiler.cc and for ROCM (AMD) this file amdgpu_compiler.cc exists.

If I see the compiler file writing SYCL backend of XLA, I'll at least gather some idea about the modules and way or writing it.

@Zantares
Copy link

Unrelated,

I'm a bit confused about how XLA Backend works, glad you all are working with the SYCL backend. Can you please point out where sycl_compiler.cc exists? Like for NVIDIA this file nvptx_compiler.cc and for ROCM (AMD) this file amdgpu_compiler.cc exists.

If I see the compiler file writing SYCL backend of XLA, I'll at least gather some idea about the modules and way or writing it.

Hi @abhaskumarsinha , actually we are using SPIRV target + SYCL runtime. I suppose you are asking this spirv_compiler.cc. It's a part of our upstream work and under working. You can check the whole work by this preview PR: #9042

@abhaskumarsinha
Copy link

Hi @abhaskumarsinha , actually we are using SPIRV target + SYCL runtime. I suppose you are asking this spirv_compiler.cc. It's a part of our upstream work and under working. You can check the whole work by this preview PR: #9042

Thank you @Zantares . I'm a bit noob here, do ASICs/FPGA support OpenCL/SYCL, can they support SPRIV?
Thank you for your PR. I'm glad to know there is some work going on here. It'll take some time for me to get some idea of how backends work in XLA. Thank you.

@Zantares
Copy link

do ASICs/FPGA support OpenCL/SYCL, can they support SPRIV?

It's up to your software stack. It usually needs 2 parts to support new hardware here:

  • Code-gen, it's SPIRV for us here. You can see LLVM/MLIR... different code-gen in OpenXLA.
  • Runtime, it's SYCL for us here. Same as above. you can see CPU/CUDA/ROCm... to manage different hardware resources.

So, you can choose the most suitable solution by combining these options.

@abhaskumarsinha
Copy link

@Zantares Okay, got it.

Can I see code-gen docs/library files in OpenXLA to understand what is happening here?

Can I use LLVM (code-gen) + SYCL (runtime) after PR #9042 ? I believe this should be sufficient for most of our hardware jobs.

@Zantares
Copy link

Can I see code-gen docs/library files in OpenXLA to understand what is happening here?

Hi @abhaskumarsinha , you can refer to the OpenXLA Arch Overview doc, especially the Compiler Backend section to understand it better. In addition, you can consult the community maintainer @penpornk or others for specific questions, since I'm also a hardware vendor developer and not clear about the roadmap or future tech design.

Can I use LLVM (code-gen) + SYCL (runtime) after PR #9042 ? I believe this should be sufficient for most of our hardware jobs.

You can reuse most works of #9042 once it's merged, but you still need to reorganize the bazel build dependency since you plan to use LLVM + SYCL rather than the current SPIRV + SYCL. Another point is that we used level_zero as the underlayer of SYCL runtime, you may need to change it to your own HW Driver.

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.

8 participants