KernelShift / definitions /simd-loop /loop_127.json
VanishD's picture
shuaiwei huang
allen wu
weihua du
KernelShift dataset
bbe836b
Raw History Blame Contribute Delete
1.03 kB
{
"name": "loop_127",
"op_type": "loop_127",
"description": "Search an array for the first element satisfying a condition, exit immediately on match",
"tags": [
"simd-loop",
"sme2-kernel:streaming-sve"
],
"axes": {
"N": {
"type": "var",
"description": "Array length"
}
},
"inputs": {
"a": {
"shape": [
"N"
],
"dtype": "int32"
},
"b": {
"shape": [
"N"
],
"dtype": "int32"
}
},
"outputs": {
"res": {
"shape": null,
"dtype": "uint32",
"description": "Scalar result"
}
},
"reference": "import numpy as np\n\ndef run(a, b):\n # early exit on a[i]==512 never fires with generated inputs (values 1-100)\n res = np.uint32(0)\n for i in range(len(a)):\n res = np.uint32((int(res) + int(a[i]) * int(b[i])) & 0xFFFFFFFF)\n if a[i] == 512:\n break\n return res\n",
"simd_loop_meta": {
"output_inplace": false,
"array_pad": 0,
"scratch": []
}
}