awu12's picture
Replace pre-PR#15 conv2d-only trace with current simd-loop set (definitions + workloads + reference/autovec solutions)
f25167e verified
Raw
History Blame Contribute Delete
957 Bytes
{
"name": "loop_006",
"op_type": "loop_006",
"description": "Compute the length of many long null-terminated strings",
"tags": [
"simd-loop"
],
"axes": {
"N": {
"type": "var",
"description": "Buffer length (bytes)"
}
},
"inputs": {
"p": {
"shape": [
"N"
],
"dtype": "uint8"
}
},
"outputs": {
"checksum": {
"shape": null,
"dtype": "uint32",
"description": "Scalar checksum"
}
},
"reference": "import numpy as np\n\ndef run(p):\n b = p; n = len(b); i = 0; res = 0\n while i < n:\n j = i\n while j < n and int(b[j]) != 0: j += 1\n length = j - i; i = j + 1\n res = (res + 1) & 0xffffffff\n res ^= ((length % 0xffff) << 16) & 0xffffffff\n res &= 0xffffffff\n return np.uint32(res)\n",
"simd_loop_meta": {
"output_inplace": false,
"array_pad": 0,
"scratch": [],
"axes_order": []
}
}