-
Notifications
You must be signed in to change notification settings - Fork 172
[CIR][CUDA] CallConvLowering for basic types in NVPTX #1468
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
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 pending some nits
// getKind() > BuiltinType::Void && getKind() <= BuiltinType::NullPtr | ||
// which is confusing and unavailable in CIR. | ||
// Here we manually list out all corresponding types in CIR. | ||
return isa<IntType, BoolType, SingleType, DoubleType, FP16Type, FP128Type, |
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.
Please add a helper function in clang/include/clang/CIR/Dialect/IR/CIRTypes.h
, just like we have isAnyFloatingPointType
, we should also have isScalarType
, and just use it here.
clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/NVPTX.cpp
Outdated
Show resolved
Hide resolved
Seems like there are failing tests too |
41f78d0
to
01b8beb
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
70af95d
to
04a435e
Compare
There are some subtleties here. This is the code in OG: ```cpp // note: this is different from default ABI if (!RetTy->isScalarType()) return ABIArgInfo::getDirect(); ``` which says we should return structs directly. It's correct, has have the same behaviour as `nvcc`, and it obeys the PTX ABI as well. The comment dates back to 2013 (see [this commit](llvm/llvm-project@f9329ff) -- it didn't provide any explanation either), so I believe it's outdated. I didn't include this comment in the PR.
There are some subtleties here. This is the code in OG: ```cpp // note: this is different from default ABI if (!RetTy->isScalarType()) return ABIArgInfo::getDirect(); ``` which says we should return structs directly. It's correct, has have the same behaviour as `nvcc`, and it obeys the PTX ABI as well. The comment dates back to 2013 (see [this commit](llvm/llvm-project@f9329ff) -- it didn't provide any explanation either), so I believe it's outdated. I didn't include this comment in the PR.
There are some subtleties here.
This is the code in OG:
which says we should return structs directly. It's correct, has have the same behaviour as
nvcc
, and it obeys the PTX ABI as well.The comment dates back to 2013 (see this commit -- it didn't provide any explanation either), so I believe it's outdated. I didn't include this comment in the PR.