AMDMIGraphX icon indicating copy to clipboard operation
AMDMIGraphX copied to clipboard

MIGraphX is generating deadcode while compiling BERT model

Open umangyadav opened this issue 1 year ago • 0 comments

module: "mlir_main:pointwise157"
mlir_main:pointwise157:@0 = @literal{0.125} -> half_type, {1}, {0}
mlir_main:pointwise157:y1 = @param:y1 -> half_type, {1, 1, 2304}, {2304, 2304, 1}
mlir_main:pointwise157:y0 = @param:y0 -> half_type, {1, 1, 2304}, {2304, 2304, 1}
mlir_main:pointwise157:@3 = slice[axes={2},starts={0},ends={768}](mlir_main:pointwise157:y0) -> half_type, {1, 1, 768}, {2304, 2304, 1}
mlir_main:pointwise157:@4 = reshape[dims={1, 1, 12, 64}](mlir_main:pointwise157:@3) -> half_type, {1, 1, 12, 64}, {768, 768, 64, 1}
mlir_main:pointwise157:@5 = transpose[permutation={0, 2, 1, 3}](mlir_main:pointwise157:@4) -> half_type, {1, 12, 1, 64}, {768, 64, 768, 1}
mlir_main:pointwise157:@6 = contiguous(mlir_main:pointwise157:@5) -> half_type, {1, 12, 1, 64}, {768, 64, 64, 1}
mlir_main:pointwise157:@7 = slice[axes={2},starts={768},ends={1536}](mlir_main:pointwise157:y1) -> half_type, {1, 1, 768}, {2304, 2304, 1}
mlir_main:pointwise157:@8 = reshape[dims={1, 1, 12, 64}](mlir_main:pointwise157:@7) -> half_type, {1, 1, 12, 64}, {768, 768, 64, 1}
mlir_main:pointwise157:@9 = transpose[permutation={0, 2, 3, 1}](mlir_main:pointwise157:@8) -> half_type, {1, 12, 64, 1}, {768, 64, 1, 768}
mlir_main:pointwise157:@10 = contiguous(mlir_main:pointwise157:@9) -> half_type, {1, 12, 64, 1}, {768, 64, 1, 1}
mlir_main:pointwise157:@11 = dot(mlir_main:pointwise157:@6,mlir_main:pointwise157:@10) -> half_type, {1, 12, 1, 1}, {12, 1, 1, 1}
mlir_main:pointwise157:@12 = multibroadcast[out_lens={1, 12, 1, 1},out_dyn_dims={}](mlir_main:pointwise157:@0) -> half_type, {1, 12, 1, 1}, {0, 0, 0, 0}
mlir_main:pointwise157:@13 = mul(mlir_main:pointwise157:@11,mlir_main:pointwise157:@12) -> half_type, {1, 12, 1, 1}, {12, 1, 1, 1}
mlir_main:pointwise157:@14 = sub(mlir_main:pointwise157:@13,mlir_main:pointwise157:@13) -> half_type, {1, 12, 1, 1}, {12, 1, 1, 1}
mlir_main:pointwise157:@15 = exp(mlir_main:pointwise157:@14) -> half_type, {1, 12, 1, 1}, {12, 1, 1, 1}
mlir_main:pointwise157:@16 = div(mlir_main:pointwise157:@15,mlir_main:pointwise157:@15) -> half_type, {1, 12, 1, 1}, {12, 1, 1, 1}
mlir_main:pointwise157:@17 = @return(mlir_main:pointwise157:@16)

Notice mlir_main:pointwise157:@14 = sub(mlir_main:pointwise157:@13,mlir_main:pointwise157:@13) is computing zero.

Need to figure out why this is happening.

this can be reproduced by running :

./build/bin/driver perf /models/ORT/bert_base_cased_1.onnx --fill1 input_ids --fp16 --exhaustive-tune

umangyadav avatar Jun 05 '24 12:06 umangyadav