-
Notifications
You must be signed in to change notification settings - Fork 74.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR][XLA] Add GatherOp to LHLO/HLO emitters #40578
[MLIR][XLA] Add GatherOp to LHLO/HLO emitters #40578
Conversation
@timshen91 can you help providing guidance about where we want the HLO->LHLO conversion be handled right now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you so much! Could you also add xla_hlo.GatherOp -> xla_lhlo.GatherOp conversion to hlo_legalize_to_lhlo.cc
? it should be just one line to populate the patterns, one line in map_hlo_to_lhlo_op.h
to map the ops and a test.
|
||
// CHECK: func @gather(%[[ARG0:.*]]: [[TYPE0:.*]], %[[ARG1:.*]]: [[TYPE1:.*]], %[[RESULT:.*]]: [[RTYPE:.*]]) { | ||
// CHECK: "xla_lhlo.gather"(%[[ARG0]], %[[ARG1]], %[[RESULT]]) | ||
// CHECK: {collapsed_slice_dims = dense<0> : tensor<1xi64>, index_vector_dim = 2 : i64, offset_dims = dense<2> : tensor<1xi64>, slice_sizes = dense<[1, 10]> : tensor<2xi64>, start_index_map = dense<0> : tensor<1xi64>} : ([[TYPE0]], [[TYPE1]], [[RTYPE]]) -> () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please use CHECK-SAME to wrap the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git clang-format?
input.offset_dims().end()); | ||
std::vector<int64> gather_collapsed_slice_dims( | ||
input.collapsed_slice_dims().begin(), input.collapsed_slice_dims().end()); | ||
std::vector<int64> gather_start_index_map(input.start_index_map().begin(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use SmallVector instead. I assume that these attributes aren't very large in general.
(see LhloDialectEmitter::HandleReduceWindow for example)
@xinan-jiang Can you please check @joker-eph's comments and keep us posted. Thanks! |
Unassigning myself since @pifon2a is more familiar with this code. |
This is a PR from JIZHI, the AI platform in Tencent.
@sherhut @pifon2a
We work on TensorFlow/MLIR to make mlir_gpu enable. Could you tell me how to run the test? It seems need a new tool.