Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor VectorAPI boxing fixes #20791

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions runtime/compiler/optimizer/VectorAPIExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ TR_VectorAPIExpansion::visitNodeToBuildVectorAliases(TR::Node *node, bool verify
}
else if (boxingAllowed() &&
opCodeValue == TR::astore &&
rhs->getOpCode().isFunctionCall())
rhs->getOpCodeValue() != TR::aload)
{
_aliasTable[id1]._elementType = TR::Address;
dontVectorizeNode(node);
Expand Down Expand Up @@ -1566,11 +1566,7 @@ TR_VectorAPIExpansion::unboxNode(TR::Node *parentNode, TR::Node *operand, vapiOb
bool parentVectorizedOrScalarized = isVectorizedOrScalarizedNode(parentNode, elementType, bitsLength,
parentType, parentScalarized);

// TODO: enable mask unboxing after general bug of using masks read from arrays is fixed
//
static bool enableMaskUnboxing = feGetEnv("TR_enableMaskUnboxing") ? true : false;

if ((operandObjectType != Vector && (operandObjectType != Mask || !enableMaskUnboxing)) ||
if ((operandObjectType != Vector && operandObjectType != Mask) ||
elementType != TR::Int8 ||
bitsLength != 128 ||
parentScalarized) // TODO: support unboxing into scalars
Expand Down Expand Up @@ -1802,8 +1798,17 @@ TR_VectorAPIExpansion::transformIL(bool checkBoxing)
int32_t elementSize = OMR::DataType::getSize(elementType);
numLanes = bitsLength/8/elementSize;

// TODO: add an assert that unboxing is not needed in this case since the temp
// would not be vectorized
if (boxingAllowed())
{
TR::DataType elementTypeTmp;
int32_t bitsLengthTmp;
vapiObjType objectTypeTmp;
bool scalarizedTmp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to initialize these 4 Tmp(s)? and, they are not used after coming back from the call. we experienced a very elusive bug when a call is made with arguments not initialized (although the code was correct): OpenXL optimizer just generated garbage code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are values set by the call and they are not used in this case. Not sure how to make that nicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do it in other places too. In the future we can return a structure filled in with those values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I gave them *Tmp names to make it more obvious.

bool rhsVectorizedOrScalarized = isVectorizedOrScalarizedNode(node->getFirstChild(), elementTypeTmp, bitsLengthTmp,
objectTypeTmp, scalarizedTmp);

TR_ASSERT_FATAL(rhsVectorizedOrScalarized, "RHS of vectorized astore should be vectorized too");
}

if (!checkBoxing)
astoreHandler(this, treeTop, node, elementType, vectorLength, numLanes, doMode);
Expand Down