MCPcopy Create free account
hub / github.com/apache/tvm / impl

Function impl

python/tvm/s_tir/tensor_intrin/arm_cpu.py:271–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

269 A_t[v_k, v_m] = A[v_m, v_k]
270
271 def impl():
272 sub_tile_count = 4
273
274 with IRBuilder() as ib:
275 with build_prim_func():
276 a = T.arg("a", T.handle())
277 a_t = T.arg("a_t", T.handle())
278
279 A = T.match_buffer(
280 a, (SVF2, SVF2), "float32", offset_factor=1, strides=[T.int32(), 1]
281 )
282 A_t = T.match_buffer(
283 a_t,
284 (SVF2, SVF2),
285 "float32",
286 offset_factor=1,
287 strides=[T.int32(), 1],
288 )
289
290 with T.sblock("root"):
291 T.reads(A[0:SVF2, 0:SVF2])
292 T.writes(A_t[0:SVF2, 0:SVF2])
293
294 # Load rows of the input matrix
295 with T.serial(0, SVF) as slice_idx:
296 for sub_tile_idx in range(0, sub_tile_count):
297 row_offset = SVF if sub_tile_idx >= (sub_tile_count // 2) else 0
298 col_offset = SVF if sub_tile_idx % 2 else 0
299 offset = (slice_idx + row_offset) * A.strides[0] + col_offset
300
301 input_ptr = A.access_ptr("r", offset=offset)
302 sub_tile = T.int32(sub_tile_idx)
303 predicate = _create_active_lane_mask(
304 A, (row_offset + slice_idx, col_offset), cols
305 )
306 T.evaluate(
307 T.call_llvm_intrin(
308 "void",
309 "llvm.aarch64.sme.ld1w.horiz",
310 predicate,
311 input_ptr,
312 sub_tile,
313 slice_idx,
314 )
315 )
316
317 # Store columns to the output matrix
318 with T.serial(0, SVF) as slice_idx:
319 for sub_tile_idx in range(0, sub_tile_count):
320 col_offset = SVF if sub_tile_idx >= (sub_tile_count // 2) else 0
321 row_offset = SVF if sub_tile_idx % 2 else 0
322 offset = (slice_idx + row_offset) * A_t.strides[0] + col_offset
323
324 output_ptr = A_t.access_ptr("w", offset=offset)
325 sub_tile = T.int32(sub_tile_idx)
326 predicate = _create_active_lane_mask(
327 A_t, (row_offset + slice_idx, col_offset), rows
328 )

Calls 6

IRBuilderClass · 0.90
_create_active_lane_maskFunction · 0.85
_create_ptrue_maskFunction · 0.85
access_ptrMethod · 0.80
evaluateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…