User Details
- User Since
- Aug 2 2021, 12:24 AM (85 w, 4 d)
Jul 31 2022
May 17 2022
From my point of view this patch LGTM.
May 9 2022
Sounds good to me. I’ll make a new patch when there is a need for it and close this one.
Feb 3 2022
Thanks for the review, @yaxunl. Could you push this to the LLVM? And to the LLVM 14 release branch too, if possible?
Feb 2 2022
Jan 26 2022
Jan 25 2022
SPIR-V target requires that the OS and the environment type is unknown (see TargetInfo::AllocateTarget and BaseSPIRTargetInfo). The clang would fail to create a SPIR-V target if there is an OS or environment component in the target string known by the Triple. This could lead to a misleading error message.
Dec 21 2021
This patch should be ready to land. @tra, could you please commit it to the LLVM for us? Thanks.
Rebase.
Thanks, @yaxunl.
Dec 16 2021
Assuming that this patch is ready to land. @tra or @yaxunl, could you please commit this patch to the LLVM for us? Thanks.
If I understand correctly, the default optimization level is -O2 for the OpenCL and OpenCL++ language mode (according to CompilerInvocation.cpp:getOptimizationLevel()). Since higher than -O0 may not work with the translator, should the SPIR-V tool chain override this default and set it to -O0 (unless a user passes some -O option)?
Rebase.
Dec 14 2021
Thanks, @tra.
This patch should be ready to land. @tra, could you please commit this to the LLVM for us. Thanks.
Rebase.
Dec 13 2021
Thanks, @yaxunl.
D109818 includes the change in this patch.
Dec 10 2021
Assuming this patch is ready to land. @yaxunl, Could you please commit this patch to the LLVM for us. Thanks.
Rebase.
Dec 8 2021
Thanks, @bader.
Thanks for the feedback. The --offload is meant to support multiple targets but right now it is restricted to one at most. The limitation comes from the HIPActionBuilder and CudaActionBuilderBase which currently expects a single target triple and toolchain for all offload devices. To relax the --offload target count cap we would need to adjust the action builders to support multiple target triples and create a separate toolchain for each (unique) target triple.
- Add comments to clarify the limitation of the --offload option to one target.
Rebase.
Rebase.
Cherry-picking should work now, @bader.
Rebase.
Dec 3 2021
The patch is ready to land. @Anastasia, @bader, could you commit this patch to the LLVM for us? Thanks.
Thanks, @Anastasia.
Dec 1 2021
@tra, gentle ping.
@Anastasia, Could you please commit this patch to the LLVM for us? Thanks.
Nov 25 2021
Disable debug info generation for device code.
Nov 24 2021
Nov 23 2021
Thanks for the review.
Thanks for the review.
Retry push changes.
Update a driver test case.
Combine options with append().
Nov 18 2021
Thanks for the help!
- Adjust --offload description: reflect the current state.
- Adjust enum range check in IsAMDGpuArch().
- Make --offload and --offload-arch options mutually exclusive.
Nov 16 2021
Gentle ping.
Gentle ping.
Ping?
Hi @Anastasia and @bader,
Rebase.
Rebase.
Rebase.
Rebase.
Rebase.
Rebase.
Nov 15 2021
Rebase, add asserts and move address space map reset for HIP from SPIRVTargetInfo to BaseSPIRTargetInfo
Rebase.
Nov 2 2021
Is this patch ready to land on the LLVM? We do not have commit rights, so can you please commit this patch for us? Thanks.
Oct 28 2021
Rebase on updated llvm-spirv tool (D112404).
Thanks for the review.
Rename SPIRV::Translator's tool names as suggested by bader.
Oct 27 2021
Update for changes in D112404.
Remove --spirv-ext and --spirv-max-version.
Do I read it correctly that you would have no objections for others to rework this patch if needed? :)
Oct 26 2021
Improve --offload option description.
Gentle ping. Is anything needed to be addressed to get this patch accepted?
Gentle ping.
Gentle ping. Is anything needed to be addressed to get this patch accepted?
Thanks for the review. Updated the patch with the style suggestions.
Rephrase expressions.
Oct 25 2021
Rebase.
Rebase.
Rebase.
Rebase and use SPIRV::constructTranslateCommand() to contruct
the LLVM-SPIR-V translation command.
Oct 24 2021
Rebase.
Rebase.
Rebase.
Rebase.
Oct 15 2021
Thanks for the clarifications. So it seems that you are not expecting that the device target triple is being explicitly passed anywhere then and that means you pass the device triple implicitly?
We are meaning to use the --offload as a way to pass device target triple explicitly.
Although your --offload option does seem conceptually like a device target triple, so I wonder if better naming for it would be --offload-target? Would it work for you if we introduce SPIR-V triple explicitly and you use it as a device offload triple?
To introduce a way to pass a device target triple in HIP compilation, we decided it to be aligned with the envisioned “Unified Offload Option” feature [1] to avoid overlap with similar concept. The design of the feature is pending. AFAIK, @yaxunl, who is working on it, hasn't got time yet to continue the work. In D110622 we propose adding the --offload option as partial implementation and there is a bit of discussion about the design too.
It would probably makes sense to use the same triple to targeting SPIR-V generation by everyone?
Yes, it makes sense.
However I appreciate that OpenCL flow would be somewhat different since it doesn't have a split into host and device but only contains device compilation phase...
The split is specific to offloading languages (such as CUDA, HIP and OpenMP) whose compilation flow is different from the traditional compilation flow. The traditional compilation flow used for non-offloading languages naturally does not have the host/device compilation split.
Oct 13 2021
Can you explain what does this mean
It was trying to clarify a potential misunderstanding of how programs are compiled when HIPSPV is targeted: For HIPSPV, the SPIR-V code generation is done by the clang driver. When we compile HIP programs for HIPCL or the HIPLZ runtime, we issue a single clang command such as this:
clang++ --offload=spirv64 foo.hip -l<hip-runtime> -o foo
With this, the clang driver compiles the device side code to a SPIR-V binary and then compiles host side code, and embeds the SPIR-V binary to the host (fat) binary.
Oct 8 2021
> What I have in mind is to continue using SPIR target for now (until SPIR-V back-end is added).
For instance, SYCL compiler emits code for SPIR target and code format is configured via flag.
-emit-llvm changes output file format for regular C++ compilation flow:
clang++ a.cpp -c -o a.o # object format by default clang++ a.cpp -c -emit-llvm -o a.bc # LLVM IR format with `-emit-llvm`Similar approach for HIP device compilation flow:
clang++ -target spir -x hip a.cpp -cuda-device-only -o a.spv # SPIR-V format by default clang++ -target spir -x hip a.cpp -cuda-device-only -emit-llvm -o a.bc # LLVM IR (aka SPIR) format with `-emit-llvm` if neededI think this was proposed in RFC. @linjamaki, am I right?
Oct 6 2021
Oct 4 2021
Repurpose 'Generic' CudaArch, Use getAllArgValues() for reading
--offload values and fix a enum range.
Update option description.
I don’t think it would work out well. llvm-spirv (or other tool relying on LLVM bitcode input) and LLVM may have version differences that cause obscure error cases - like newer LLVM producing bitcode with new features the tools are not expecting and ready for them. The usage of llvm-spirv tool in the HIPSPV tool chain is not intended to be a longer term solution due to this shortcoming.