[intrin]support fmod for cuda#1964
Conversation
| """ | ||
| return call_pure_intrin(x.dtype, "popcount", x) | ||
|
|
||
| def mod(x, y): |
There was a problem hiding this comment.
rename to fmod as we already have Mod in the ir node
| return ir::Reduce::make(combiner, {source}, rdom, make_const(Bool(1), true), 0); | ||
| } | ||
|
|
||
| Expr mod(Expr x, Expr y) { |
| check_device("cuda", "llvm") | ||
| check_device("vulkan") | ||
|
|
||
| def test_mod(): |
| test_add() | ||
| test_log_pow_llvm() | ||
| test_popcount() | ||
| test_mod() |
|
|
||
| Expr fmod(Expr x, Expr y) { | ||
| BinaryOpMatchTypes(x, y); | ||
| CHECK(x.type().is_float()) << "mod only applies to float"; |
| 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.
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!