-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 helper functions to query properties of the lowered Target (#8192) #8359
Conversation
//@{ | ||
Expr target_arch_is(Target::Arch arch); | ||
Expr target_os_is(Target::OS os); | ||
Expr target_has_feature(Target::Feature feat); |
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.
This one should perhaps get a big warning that this does not check runtime-features of the CPU or device, but uses the compile-time target. I know it says that in the doc above, but I feel like many people will get fooled by their wrong intuition. It's especially tricky, as it returns an Expr
and not a bool
, so it gives off a runtime-vibe.
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.
Done
This could be expanded to more of the Target API, but I stopped here; some other possibilities would be
|
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.
This would address my use-case
@abadams Is there a way to get the device type of the enclosing loop for a given expression? Context: I'm working on the fast_atan, and it seems that LLVM has a good version of atan already implemented for CUDA akin to what the fast-version would be. So, I'd like to just select the default |
No, but it seems like it would be pretty simple to add, in the same manner of the helpers I just added. Feel free to open a PR to do so (it may be a little while before I can get to it). |
No description provided.