Skip to content

Commit 7ea9c41

Browse files
ermilovmaximtensorflower-gardener
authored andcommitted
rename CompileToPtx to CompileToTargetBinary
PiperOrigin-RevId: 937650110
1 parent fd93394 commit 7ea9c41

7 files changed

Lines changed: 14 additions & 12 deletions

File tree

third_party/xla/xla/backends/gpu/codegen/cubin_custom_kernel_compiler.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,21 @@ xla::Future<LlvmKernelSource> CubinCustomKernelCompiler::CompileMlirToLlvm(
8787
});
8888
}
8989

90-
xla::Future<std::vector<uint8_t>> CubinCustomKernelCompiler::CompileToPtx(
90+
xla::Future<std::vector<uint8_t>>
91+
CubinCustomKernelCompiler::CompileToTargetBinary(
9192
LlvmKernelSource kernel_source) {
9293
if (!thread_pool_) {
93-
return CompileToPtxImpl(std::move(kernel_source));
94+
return CompileToCubinImpl(std::move(kernel_source));
9495
}
9596
return xla::MakeFutureOn(
9697
*thread_pool_->AsExecutor(),
9798
[this, kernel_source = std::move(kernel_source)]() mutable {
98-
return CompileToPtxImpl(std::move(kernel_source));
99+
return CompileToCubinImpl(std::move(kernel_source));
99100
});
100101
}
101102

102103
absl::StatusOr<std::vector<uint8_t>>
103-
CubinCustomKernelCompiler::CompileToPtxImpl(LlvmKernelSource kernel_source) {
104+
CubinCustomKernelCompiler::CompileToCubinImpl(LlvmKernelSource kernel_source) {
104105
llvm::orc::ThreadSafeModule thread_safe_module =
105106
std::move(kernel_source).thread_safe_module();
106107
llvm::Module* llvm_module = thread_safe_module.getModuleUnlocked();
@@ -120,7 +121,7 @@ absl::StatusOr<std::unique_ptr<Thunk>> CubinCustomKernelCompiler::CompileImpl(
120121
const emitters::KernelArguments& kernel_arguments,
121122
const LaunchDimensions& launch_dimensions) {
122123
ASSIGN_OR_RETURN(std::vector<uint8_t> cubin,
123-
CompileToPtxImpl(std::move(kernel_source)));
124+
CompileToCubinImpl(std::move(kernel_source)));
124125

125126
ASSIGN_OR_RETURN(
126127
CustomKernel custom_kernel,

third_party/xla/xla/backends/gpu/codegen/cubin_custom_kernel_compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class CubinCustomKernelCompiler final : public KernelCompiler {
8080
const std::string& entry_function_name, int unroll_factor,
8181
MlirKernelSource source, BorrowedMlirContext borrowed_context) override;
8282

83-
xla::Future<std::vector<uint8_t>> CompileToPtx(
83+
xla::Future<std::vector<uint8_t>> CompileToTargetBinary(
8484
LlvmKernelSource kernel_source) override;
8585

8686
xla::Future<TritonWrapperResult> CompileTritonToLlvm(
@@ -92,7 +92,7 @@ class CubinCustomKernelCompiler final : public KernelCompiler {
9292
bool is_xla_fusion) override;
9393

9494
private:
95-
absl::StatusOr<std::vector<uint8_t>> CompileToPtxImpl(
95+
absl::StatusOr<std::vector<uint8_t>> CompileToCubinImpl(
9696
LlvmKernelSource kernel_source);
9797

9898
absl::StatusOr<std::unique_ptr<Thunk>> CompileImpl(

third_party/xla/xla/backends/gpu/codegen/emitters/mlir_kernel_emitter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ AsyncThunkSequence MlirKernelFusion::Emit(
393393
ir_emitter_context.gpu_device_info());
394394

395395
return ir_emitter_context.kernel_compiler()
396-
->CompileToPtx(std::move(kernel_def).TakeSource())
396+
->CompileToTargetBinary(std::move(kernel_def).TakeSource())
397397
.Map([kernel_name = std::move(kernel_name),
398398
launch_dims = std::move(launch_dims),
399399
use_pdl](const std::vector<uint8_t>& cubin) {

third_party/xla/xla/backends/gpu/codegen/kernel_compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class KernelCompiler {
9090
TritonKernelSource triton_source, BorrowedMlirContext borrowed_context,
9191
bool is_xla_fusion) = 0;
9292

93-
virtual xla::Future<std::vector<uint8_t>> CompileToPtx(
93+
virtual xla::Future<std::vector<uint8_t>> CompileToTargetBinary(
9494
LlvmKernelSource kernel_source) = 0;
9595

9696
// Sets a callback to be called prior to llvm::Module compilation.

third_party/xla/xla/backends/gpu/codegen/triton/fusion.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ xla::Future<TritonFusion::EmitResult> TritonFusion::Emit(
236236
local_module.getModuleUnlocked()));
237237

238238
return kernel_compiler
239-
->CompileToPtx(LlvmKernelSource{std::move(local_module)})
239+
->CompileToTargetBinary(LlvmKernelSource{std::move(local_module)})
240240
.Map([kernel_name = sanitized_kernel_name,
241241
launch_dims = std::move(launch_dimensions),
242242
tma_metadata = triton_wrapper_result.tma_metadata,

third_party/xla/xla/service/gpu/compile_module_to_llvm_ir.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ absl::StatusOr<CompileModuleResults> CompileModuleToLlvmIr(
267267

268268
ASSIGN_OR_RETURN(
269269
results.constants_binary,
270-
compiler->CompileToPtx(thunk_emitter.ConsumeConstantsModule()).Await());
270+
compiler->CompileToTargetBinary(thunk_emitter.ConsumeConstantsModule())
271+
.Await());
271272
ASSIGN_OR_RETURN(results.executable,
272273
std::move(future_sequential_thunk).Await());
273274

third_party/xla/xla/service/gpu/thunk_emitter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ AsyncThunkSequence ThunkEmitter::EmitTritonCustomCall(
13291329
local_module.getModuleUnlocked()));
13301330

13311331
return kernel_compiler
1332-
->CompileToPtx(LlvmKernelSource{std::move(local_module)})
1332+
->CompileToTargetBinary(LlvmKernelSource{std::move(local_module)})
13331333
.Map([use_pdl = result.use_pdl, shmem_bytes = result.shmem_bytes,
13341334
launch_dimensions = std::move(launch_dimensions),
13351335
tma_metadata = result.tma_metadata,

0 commit comments

Comments
 (0)