From 128bfc0665ba937afec0e06064b7c90fae53ead7 Mon Sep 17 00:00:00 2001 From: Adrian Lizarraga Date: Thu, 6 Jun 2024 15:11:59 -0700 Subject: [PATCH] [MLAS] Use C-style casting for power vector instructions (#20957) ### Description Uses C-style casting for Power vector instructions in `MlasQuantizeLinearInt4Kernel`. ### Motivation and Context Vector commands (e.g., vec_xst) need C-style casting to support various compiler versions. ONNX Runtime CI pipelines do not build with all compiler versions. The recent INT4 PR broke the powerpc build for certain compiler versions because it uses C++-style `static_cast<>`. See: https://github.com/microsoft/onnxruntime/pull/20362#discussion_r1630106164 Signed-off-by: adrianlizarraga --- onnxruntime/core/mlas/lib/power/QuantizePower.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/mlas/lib/power/QuantizePower.cpp b/onnxruntime/core/mlas/lib/power/QuantizePower.cpp index 0cfa56740edf..2d4d791c3a00 100644 --- a/onnxruntime/core/mlas/lib/power/QuantizePower.cpp +++ b/onnxruntime/core/mlas/lib/power/QuantizePower.cpp @@ -2,6 +2,9 @@ #include "mlasi.h" #include +// NOTE: Vector commands (e.g., vec_xst) need C-style casting to support various compiler versions. +// ONNX Runtime CI pipelines do not build with all compiler versions. + template void MLASCALL @@ -194,7 +197,7 @@ Return Value: auto ShortVector1 = vec_pack(IntegerVector2, IntegerVector3); auto CharVector = vec_pack(ShortVector0, ShortVector1); - vec_xst(CharVector, 0, static_cast(&TmpOutput[0])); + vec_xst(CharVector, 0, (int8_t *)(&TmpOutput[0])); MlasPackInt4Elements(Output++, TmpOutput[0], TmpOutput[1]); MlasPackInt4Elements(Output++, TmpOutput[2], TmpOutput[3]);