Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aqjune
Created November 11, 2021 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqjune/68cd575594b8e334c2168d3c74ff2432 to your computer and use it in GitHub Desktop.
Save aqjune/68cd575594b8e334c2168d3c74ff2432 to your computer and use it in GitHub Desktop.
bufferize-fail.mlir
#map0 = affine_map<(d0, d1) -> (d0, d1)>
#map1 = affine_map<(d0) -> (d0)>
#map2 = affine_map<(d0, d1) -> (d0)>
module {
func @encrypt(%arg0: tensor<18x131072xi64>, %arg1: tensor<18x131072xi64>) -> tensor<18x131072xi64> {
%cst = arith.constant dense<[1, 131072]> : tensor<2xi64>
%cst_0 = arith.constant dense<1> : tensor<1xi64>
%cst_1 = arith.constant dense<131072> : tensor<1xi64>
%cst_2 = arith.constant dense<[30, 1]> : tensor<2xi64>
%c18 = arith.constant 18 : index
%c1 = arith.constant 1 : index
%c0 = arith.constant 0 : index
%cst_3 = arith.constant dense<[2305843009146585089, 2251799756013569, 2251799787995137, 2251800352915457, 2251799780917249, 2251799666884609, 2251799678943233, 2251799696244737, 2251800082382849, 2251799776198657, 2251799929028609, 2251799774887937, 2251799849336833, 2251799883153409, 2251799777771521, 2251799879483393, 2251799772266497, 2251799763091457, 2251799844093953, 2251799823384577, 2251799851958273, 2251799789568001, 2251799797432321, 2251799799267329, 2251799836753921, 2251799806345217, 2251799807131649, 2251799818928129, 2251799816568833, 2251799815520257]> : tensor<30xi64>
%4 = tensor.reshape %cst_3(%cst_2) : (tensor<30xi64>, tensor<2xi64>) -> tensor<30x1xi64>
%5 = tensor.extract_slice %4[0, 0] [18, 1] [1, 1] : tensor<30x1xi64> to tensor<18x1xi64>
%6 = linalg.init_tensor [18, 131072] : tensor<18x131072xi64>
%7 = linalg.tiled_loop (%arg2) = (%c0) to (%c18) step (%c1) ins (%arg3 = %arg0: tensor<18x131072xi64>, %arg4 = %5: tensor<18x1xi64>) outs (%arg5 = %6: tensor<18x131072xi64>) {
%22 = tensor.extract_slice %arg3[%arg2, 0] [1, 131072] [1, 1] : tensor<18x131072xi64> to tensor<1x131072xi64>
%23 = tensor.reshape %22(%cst_1) : (tensor<1x131072xi64>, tensor<1xi64>) -> tensor<131072xi64>
%24 = tensor.extract_slice %arg4[%arg2, 0] [1, 1] [1, 1] : tensor<18x1xi64> to tensor<1x1xi64>
%25 = tensor.reshape %24(%cst_0) : (tensor<1x1xi64>, tensor<1xi64>) -> tensor<1xi64>
%26 = tensor.extract %25[%c0] : tensor<1xi64>
%27 = call @__convert(%23, %26) : (tensor<131072xi64>, i64) -> tensor<131072xi64>
%28 = tensor.reshape %27(%cst) : (tensor<131072xi64>, tensor<2xi64>) -> tensor<1x131072xi64>
%29 = tensor.insert_slice %28 into %arg5[%arg2, 0] [1, 131072] [1, 1] : tensor<1x131072xi64> into tensor<18x131072xi64>
linalg.yield %29 : tensor<18x131072xi64>
}
return %7: tensor<18x131072xi64>
}
func private @__convert(tensor<131072xi64>, i64) -> tensor<131072xi64>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment