-
Notifications
You must be signed in to change notification settings - Fork 188
Support pointer argument of built-in functions #2018
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
base: main
Are you sure you want to change the base?
Conversation
bcardosolopes
left a comment
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.
You also need to add a testcase
|
Still needs a testcase |
Hi, It's reproducible on my local project, I need to make a unit test for incubator. I'll provide it ASAP. |
|
Unfortunately I can't add a proper test for this change. The behavior depends on Clang's handling of OpenCL built-ins. |
| // emitting an addrspacecast for address-space mismatches only. | ||
| static mlir::Value getCorrectedPtr(mlir::Value argValue, mlir::Type expectedTy, | ||
| CIRGenBuilderTy &builder) { | ||
| mlir::Type argType = argValue.getType(); |
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 this doesn't exist in OG, let's just add a few asserts to clean this up:
auto ptrType = mlir::dyn_cast<cir::PointerType>(argType);
assert(ptrType && "expected pointer type");
assert(ptrType.getPointee() != expectedPtrType.getPointee() && "types should not match");
This is something that should be added at some point right? Can you perhaps just add a commented testcase to one of the testcases so that when you get to it we can enable it? |
What I had in mind is something like: __kernel void test(int size) {
__my_private_check(size == 1024, "size check!");
}For this to be testable upstream, __my_private_check (or an equivalent) would need to be a user-visible OpenCL builtin. Today it's a private, internal helper in Clang, and there is no language-level construct or intrinsic that can express this behavior. Without introducing such a builtin on the Clang side, there's unfortunately nothing meaningful I can encode as a test, even as a commented one. |
a731166 to
21c414d
Compare
No description provided.