Skip to content
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

[XLA][AMDGPU] enable AMDGPU target #20749

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cc_library(
"//tensorflow/compiler/xla/service/llvm_ir:llvm_util",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"@llvm//:amdgpu_code_gen",
"@llvm//:analysis",
"@llvm//:bit_reader",
"@llvm//:bit_writer",
Expand Down
26 changes: 22 additions & 4 deletions third_party/llvm/llvm.autogenerated.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ llvm_host_triple = "x86_64-unknown-linux_gnu"

llvm_targets = [
"AArch64",
# Uncomment to enable the AMDGPU backend.
# TODO(phawkins): use a configure-time test.
# "AMDGPU",
"AMDGPU",
"ARM",
"NVPTX",
"PowerPC",
Expand Down Expand Up @@ -256,13 +254,31 @@ llvm_target_list = [
("-gen-dag-isel", "lib/Target/AMDGPU/AMDGPUGenDAGISel.inc"),
("-gen-callingconv", "lib/Target/AMDGPU/AMDGPUGenCallingConv.inc"),
("-gen-subtarget", "lib/Target/AMDGPU/AMDGPUGenSubtargetInfo.inc"),
("-gen-tgt-intrinsic", "lib/Target/AMDGPU/AMDGPUGenIntrinsics.inc"),
("-gen-tgt-intrinsic-impl", "lib/Target/AMDGPU/AMDGPUGenIntrinsicImpl.inc"),
("-gen-tgt-intrinsic-enums", "lib/Target/AMDGPU/AMDGPUGenIntrinsicEnums.inc"),
("-gen-emitter", "lib/Target/AMDGPU/AMDGPUGenMCCodeEmitter.inc"),
("-gen-dfa-packetizer", "lib/Target/AMDGPU/AMDGPUGenDFAPacketizer.inc"),
("-gen-asm-writer", "lib/Target/AMDGPU/AMDGPUGenAsmWriter.inc"),
("-gen-asm-matcher", "lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc"),
("-gen-disassembler", "lib/Target/AMDGPU/AMDGPUGenDisassemblerTables.inc"),
("-gen-pseudo-lowering", "lib/Target/AMDGPU/AMDGPUGenMCPseudoLowering.inc"),
("-gen-searchable-tables", "lib/Target/AMDGPU/AMDGPUGenSearchableTables.inc"),
("-gen-global-isel", "lib/Target/AMDGPU/AMDGPUGenGlobalISel.inc"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is the right thing to do here, but I suspect that hand-modifying this file with "autogenerated" in the name is not going to work well.

@d0k, do you know the right thing to do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2 lines are added so missing TableGen tables in AMDGPU backend is generated. I'd like to understand how this file is autogenerated as I failed identify relevant scripts in TensorFlow repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generator is not part of open source tensorflow (annoying, I know) so changing the generated file is the right approach.

@jlebar Ping me when this lands so I can fix the generator script, otherwise it'll get overwritten the next time someone runs it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Can we just eagerly fix the generator script? It should generate the same thing as this PR anyway, so there should be no conflict upon rebasing/merging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create an internal patch to fix the generator script.

],
},
{
"name": "AMDGPU",
"lower_name": "amdgpu_r600",
"short_name": "R600",
"tbl_outs": [
("-gen-asm-writer", "lib/Target/AMDGPU/R600GenAsmWriter.inc"),
("-gen-callingconv", "lib/Target/AMDGPU/R600GenCallingConv.inc"),
("-gen-dag-isel", "lib/Target/AMDGPU/R600GenDAGISel.inc"),
("-gen-dfa-packetizer", "lib/Target/AMDGPU/R600GenDFAPacketizer.inc"),
("-gen-instr-info", "lib/Target/AMDGPU/R600GenInstrInfo.inc"),
("-gen-emitter", "lib/Target/AMDGPU/R600GenMCCodeEmitter.inc"),
("-gen-register-info", "lib/Target/AMDGPU/R600GenRegisterInfo.inc"),
("-gen-subtarget", "lib/Target/AMDGPU/R600GenSubtargetInfo.inc"),
],
},
{
Expand Down Expand Up @@ -671,6 +687,7 @@ cc_library(
copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_target_gen",
":amdgpu_r600_target_gen",
":config",
":core",
":support",
Expand All @@ -693,6 +710,7 @@ cc_library(
copts = llvm_copts + ["-Iexternal/llvm/lib/Target/AMDGPU"],
deps = [
":amdgpu_target_gen",
":amdgpu_r600_target_gen",
":config",
":core",
":mc",
Expand Down