You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/02/02 12:55:53 UTC

[GitHub] [tvm] cbalint13 commented on a change in pull request #7382: Fix missing round(), floor(), ceil() for target C lowering

cbalint13 commented on a change in pull request #7382:
URL: https://github.com/apache/tvm/pull/7382#discussion_r568579529



##########
File path: src/target/source/codegen_c.cc
##########
@@ -648,6 +648,21 @@ void CodeGenC::VisitExpr_(const CallNode* op, std::ostream& os) {  // NOLINT(*)
       os << " != ";
       this->PrintExpr(op->args[0], os);
       os << ")";
+    } else if (op->op.as<OpNode>()->name == "tir.round") {
+      CHECK_EQ(op->args.size(), 1U);

Review comment:
       * Addedd missing to ```target/intrin_rule.cc```.
   * Added test cases to check C lowering.
   * In C generated code we get proper C function calls:
   ```
   ((float*)B)[(i0)] = ceilf(((float*)A)[(i0)]);
   ((float*)B)[(i0)] = floorf(((float*)A)[(i0)]);
   ((float*)B)[(i0)] = roundf(((float*)A)[(i0)]);
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org