Skip to content

Conversation

@joaosaffran
Copy link
Collaborator

This patch is adding array operator long vector test to HLK. There are 3 scenarios that were identified when doing those tests:

  • Random access of elements: in this scenario, the generated dxil handles the access using shufflevector to order the array in the correct new order.
  • Sequential access of elements, not vectorize: the generated dxil uses a GEP instruction to calculate the correct address to access.
  • Sequential access of elements, vectorize: the code uses extracelement and insertelement to perform loads and stores.

Closes: #7618

@damyanp
Copy link
Member

damyanp commented Nov 10, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines 67 to 70
OP_DEFAULT_DEFINES(ArrayOperator, ArrayOperator_Loop, 2, "TestArrayOperatorLoop", "",
" -DFUNC_ARRAY_OPERATOR=1 -DLOOP_ATTRB=loop")
OP_DEFAULT_DEFINES(ArrayOperator, ArrayOperator_Unroll, 2, "TestArrayOperatorUnroll", "",
" -DFUNC_ARRAY_OPERATOR=1 -DLOOP_ATTRB=unroll")
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider doing the loop / unroll versions as a single "OP"? For the expected results instead of using size * 2 you could use size * 4 and in the shader just have the loops one after another?

Comment on lines 4140 to 4144
[LOOP_ATTRB] for(uint i = 0; i < OutNum; i++)
OutputVector[i] = Input1[i] + Input2[i];
[LOOP_ATTRB] for(uint i = 0; i < OutNum; i++)
g_OutputVector.Store<OUT_TYPE>(sizeof(OUT_TYPE) * (OutNum + i), OutputVector[i]);
Copy link
Member

Choose a reason for hiding this comment

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

It's not obvious to me why there are two loops here? Are they testing different dxil ops? A comment to explain this might help.

Comment on lines 4133 to 4135
vector<OUT_TYPE, OutNum> OutputVector = g_InputVector1.Load< vector<TYPE,
NUM> >(0);
OutputVector[0] = Input1[OutNum - 1];
Copy link
Member

Choose a reason for hiding this comment

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

Is there some auto formatter or something that puts this awkward line break here?

Suggested change
vector<OUT_TYPE, OutNum> OutputVector = g_InputVector1.Load< vector<TYPE,
NUM> >(0);
OutputVector[0] = Input1[OutNum - 1];
vector<OUT_TYPE, OutNum> OutputVector = g_InputVector1.Load< vector<TYPE, NUM> >(0);
OutputVector[0] = Input1[OutNum - 1];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Long Vector Execution Tests: Array Operator

2 participants