From 9eda12159feb4b385238f900ed0e1651625b14fc Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 14 Sep 2021 13:50:03 -0500 Subject: [PATCH] [Hexagon] Treat floats as float32 when passing args to offloaded kernels `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). --- src/runtime/hexagon/hexagon_module.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/hexagon/hexagon_module.cc b/src/runtime/hexagon/hexagon_module.cc index 88815c388ccd..41aa5855ceeb 100644 --- a/src/runtime/hexagon/hexagon_module.cc +++ b/src/runtime/hexagon/hexagon_module.cc @@ -483,9 +483,10 @@ hexagon::ArgLayout HexagonModuleNode::BuildArgLayout(const TVMArgs& As) const { ICHECK_EQ(static_cast(A), static_cast(A)); Args.Push(static_cast(A)); break; - // 64-bit values + // As above, treat floating point values as float32. case kDLFloat: - Args.Push(static_cast(A)); + ICHECK_EQ(static_cast(A), static_cast(static_cast(A))); + Args.Push(static_cast(static_cast(A))); break; case kTVMOpaqueHandle: