-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Enable programs that include system headers on Windows #325
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
Conversation
The previous version of this patch is here, #284 |
Melanie, please re-base this patch, it conflicts with changes from #324 |
6f2216b
to
f6b9572
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear from the commit log message what problem this patch solves.
Could you elaborate on that, please?
clang/lib/Basic/Targets/SPIR.h
Outdated
@@ -56,9 +56,12 @@ static const unsigned SYCLAddrSpaceMap[] = { | |||
}; | |||
|
|||
class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public TargetInfo { | |||
private: | |||
bool IsWindowsSYCL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically just inheriting from this type for a WindowsSPIRTargetInfo would be the way to do this.
clang/lib/Basic/Targets/SPIR.h
Outdated
@@ -141,8 +152,15 @@ class LLVM_LIBRARY_VISIBILITY SPIR64TargetInfo : public SPIRTargetInfo { | |||
SPIR64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) | |||
: SPIRTargetInfo(Triple, Opts) { | |||
PointerWidth = PointerAlign = 64; | |||
SizeType = TargetInfo::UnsignedLong; | |||
PtrDiffType = IntPtrType = TargetInfo::SignedLong; | |||
SizeType = TargetInfo::UnsignedLongLong; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this break Linux stuff? This seems like it'll mess up a bunch of types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this needs to be fixed, thanks @erichkeane
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think size type must be defined by the host triple, not SPIR.
So I think, we shoudn't modify SPIR target at all.
CmdArgs.push_back(Args.MakeArgString("-fms-compatibility-version=" + | ||
MSVT.getAsString())); | ||
else { | ||
const char *LowestMSVCSupported = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this 2 lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because clang-format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mean, why is LowestMSVCSupported a separate variable instead of just being a constant in the line below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was nicer this way, self documenting and all
Add Windows-specific predefined type characteristics for wchar, builtin VaListKind, and allow the vectorcall attribute on function declarations. Add Windows support for SPIR target. Signed-off-by: Melanie Blower <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thank you for re-working the patch, fixing triple to unknown-unknown, and for signing&squashing the commit.
…ows for SPIRV32 and SPIRV64 targets (#13548) This is text from OpenCL SPIR Spec 2.0 (https://registry.khronos.org/SPIR/specs/spir_spec-2.0.pdf) The OpenCL size_t, ptrdiff_t,uintptr_t, intptr_t, atomic_size_t, atomic_ptrdiff_t, atomic_uintptr_t and atomic_intptr_t data types are mapped to LLVM i32 when the device address width is equal to 32 bits and to LLVM i64 when the device address width is equal 64 bits. After some analysis though, I see that the windows os based customizations made for the SPIR target (#325) are necessary for successful compilation on windows. Also, they do not seem to be violating the spec. It's just that 'long' and 'long long' mean different things on windows and linux. On 64-bit linux, long type has 8 bytes, but on 64-bit windows, long type has 4 bytes. Hence, I have extended the SPIR target changes to the SPIR-V target as well. This PR extends those changes for SPIRV32 and SPIRV64 targets and added appropriate tests as well. We would eventually want to submit this (and PR #325) upstream. Thanks --------- Signed-off-by: Arvind Sudarsanam <[email protected]>
Add Windows-specific predefined type characteristics for wchar, builtin
VaListKind, and a temporary workaround for the vectorcall attribute
which is seen in the Microsoft headers.
We'll allow vectorcall to appear on function declarations, since they
occur in the Microsoft headers, but we won't allow or will ignore
vectorcall on function invocations from SYCL target. (The handling for
vectorcall is a work in progress.) Add Windows support for SPIR target.
Signed-off-by: Melanie Blower [email protected]