Skip to content

Commit

Permalink
[MLAS] Use C-style casting for power vector instructions (microsoft#2…
Browse files Browse the repository at this point in the history
…0957)

### 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:
microsoft#20362 (comment)

Signed-off-by: adrianlizarraga <adlizarraga@microsoft.com>
  • Loading branch information
adrianlizarraga authored Jun 6, 2024
1 parent 05889b3 commit 128bfc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion onnxruntime/core/mlas/lib/power/QuantizePower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "mlasi.h"
#include <altivec.h>

// 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<typename OutputType>
void
MLASCALL
Expand Down Expand Up @@ -194,7 +197,7 @@ Return Value:
auto ShortVector1 = vec_pack(IntegerVector2, IntegerVector3);

auto CharVector = vec_pack(ShortVector0, ShortVector1);
vec_xst(CharVector, 0, static_cast<int8_t *>(&TmpOutput[0]));
vec_xst(CharVector, 0, (int8_t *)(&TmpOutput[0]));

MlasPackInt4Elements(Output++, TmpOutput[0], TmpOutput[1]);
MlasPackInt4Elements(Output++, TmpOutput[2], TmpOutput[3]);
Expand Down

0 comments on commit 128bfc0

Please sign in to comment.