Skip to content

Commit

Permalink
[Hexagon] Treat floats as float32 when passing args to offloaded kern…
Browse files Browse the repository at this point in the history
…els (#9010)

`TVMArg` can hold a floating point value, but it's stored as `double`. In
Hexagon ABI doubles are passed in a register pair, but if the offloaded
function was using floats (i.e. float32), it will expect values being
passed in single registers. Since floats are much more common on Hexagon,
assume all scalar floating point values are floats. This is only an issue
with offloading, and can be treated as a limitation (we do something
analogous for integers already).
  • Loading branch information
Krzysztof Parzyszek authored Sep 15, 2021
1 parent 9bc4dc0 commit 57386a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/hexagon/hexagon_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,10 @@ hexagon::ArgLayout HexagonModuleNode::BuildArgLayout(const TVMArgs& As) const {
ICHECK_EQ(static_cast<int64_t>(A), static_cast<int32_t>(A));
Args.Push(static_cast<int>(A));
break;
// 64-bit values
// As above, treat floating point values as float32.
case kDLFloat:
Args.Push(static_cast<double>(A));
ICHECK_EQ(static_cast<double>(A), static_cast<float>(static_cast<double>(A)));
Args.Push(static_cast<float>(static_cast<double>(A)));
break;

case kTVMOpaqueHandle:
Expand Down

0 comments on commit 57386a2

Please sign in to comment.