-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[intrin]support fmod for cuda #1964
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
python/tvm/intrin.py
Outdated
| """ | ||
| return call_pure_intrin(x.dtype, "popcount", x) | ||
|
|
||
| def mod(x, y): |
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.
rename to fmod as we already have Mod in the ir node
src/lang/ir_operator.cc
Outdated
| return ir::Reduce::make(combiner, {source}, rdom, make_const(Bool(1), true), 0); | ||
| } | ||
|
|
||
| Expr mod(Expr x, Expr y) { |
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.
rename to fmod
| check_device("cuda", "llvm") | ||
| check_device("vulkan") | ||
|
|
||
| def test_mod(): |
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.
test_fmod
| test_add() | ||
| test_log_pow_llvm() | ||
| test_popcount() | ||
| test_mod() |
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.
test_mod-> test_fmod
src/lang/ir_operator.cc
Outdated
|
|
||
| Expr fmod(Expr x, Expr y) { | ||
| BinaryOpMatchTypes(x, y); | ||
| CHECK(x.type().is_float()) << "mod only applies to float"; |
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.
fmod
python/tvm/intrin.py
Outdated
| return call_pure_intrin(x.dtype, "popcount", x) | ||
|
|
||
| def fmod(x, y): | ||
| """Take mod cast of input x and y |
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.
Suggest to make the docstring slightly detailed.
|
please also check other backends(vulkan, opencl, metal, rocm, nvptx) to add this function, you might need to lookup the specific reference of each backend |
|
I've checked a bit, but I don't find the right place for Vulkan, could you guys give me a link? openCL: yes. https://manpages.debian.org/testing/opencl-1.2-man-doc/fmod.3clc.en.html |
|
Vulkan's intrinsics are defined here https://github.com/dmlc/tvm/blob/master/src/codegen/spirv/intrin_rule_spirv.cc#L33 |
|
@tqchen thanks, I mean the link of vulkan reference doc |
|
These macros are defined in |
|
@tqchen thanks We can open a thread on discussion to record the reference links so that others can get them easily |
|
Thanks @xqdan @siju-samuel this is now merged. I agree that having a documented page in the docs/dev might be helpful for developers |
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers.
@siju-samuel @PariksheetPinjari909 @Huyuwei please review, thanks!