jasonfan commited on
Commit
1421535
·
verified ·
1 Parent(s): 56bfe2d

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/buffer_sharing.h +36 -0
  2. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/compile_module_to_llvm_ir.h +81 -0
  3. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conditional_thunk.h +72 -0
  4. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conv_algorithm_picker.h +164 -0
  5. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conv_layout_normalization.h +37 -0
  6. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/convolution_thunk.h +95 -0
  7. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/copy_fusion.h +46 -0
  8. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/copy_thunk.h +70 -0
  9. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_cudnn.h +205 -0
  10. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_lt_matmul_thunk.h +85 -0
  11. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_pad_for_gemms.h +56 -0
  12. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_padding_requirements.h +47 -0
  13. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_conv_rewriter.h +116 -0
  14. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_mha_rewriter.h +54 -0
  15. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_mha_transpose_fusion.h +42 -0
  16. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_pad_for_convolutions.h +53 -0
  17. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_simplify_padding.h +64 -0
  18. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_support_utils.h +74 -0
  19. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_vectorize_convolutions.h +71 -0
  20. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cusolver_context.h +110 -0
  21. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cusolver_rewriter.h +47 -0
  22. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/custom_call_thunk.h +70 -0
  23. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/dot_dimension_sorter.h +49 -0
  24. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/elemental_ir_emitter.h +137 -0
  25. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/executable.pb.h +935 -0
  26. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fft_thunk.h +100 -0
  27. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/for_thunk.h +52 -0
  28. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fused_mha_thunk.h +129 -0
  29. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_merger.h +82 -0
  30. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_pipeline.h +40 -0
  31. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_wrapper.h +42 -0
  32. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/copy.h +45 -0
  33. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/fusion_emitter.h +88 -0
  34. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/fusions.h +41 -0
  35. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/in_place_dynamic_update_slice.h +77 -0
  36. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/input_slices.h +58 -0
  37. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/loop.h +55 -0
  38. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/reduction.h +107 -0
  39. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/thunk_util.h +37 -0
  40. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/tiling_util.h +149 -0
  41. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/transpose.h +79 -0
  42. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_algorithm_picker.h +78 -0
  43. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_broadcast_folding_rewriter.h +51 -0
  44. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_rewriter.h +62 -0
  45. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_rewriter_triton.h +173 -0
  46. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_thunk.h +57 -0
  47. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_all_gather_optimizer.h +42 -0
  48. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_asm_opts_util.h +32 -0
  49. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_async_collective_annotator.h +47 -0
  50. miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_autotuning.pb.h +1494 -0
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/buffer_sharing.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_BUFFER_SHARING_H_
17
+ #define XLA_SERVICE_GPU_BUFFER_SHARING_H_
18
+
19
+ #include <optional>
20
+
21
+ #include "xla/hlo/ir/hlo_instruction.h"
22
+ #include "xla/shape_util.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+ std::optional<bool> FusionCanShareBufferHint(const HloInstruction* user,
27
+ const HloInstruction* operand,
28
+ const ShapeIndex& user_index);
29
+
30
+ std::optional<bool> CanShareBufferHint(const HloInstruction* user,
31
+ const HloInstruction* operand,
32
+ const ShapeIndex& user_index);
33
+ } // namespace gpu
34
+ } // namespace xla
35
+
36
+ #endif // XLA_SERVICE_GPU_BUFFER_SHARING_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/compile_module_to_llvm_ir.h ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_COMPILE_MODULE_TO_LLVM_IR_H_
17
+ #define XLA_SERVICE_GPU_COMPILE_MODULE_TO_LLVM_IR_H_
18
+
19
+ #include <memory>
20
+ #include <optional>
21
+ #include <string>
22
+ #include <variant>
23
+ #include <vector>
24
+
25
+ #include "xla/hlo/ir/hlo_module.h"
26
+ #include "xla/service/buffer_value.h"
27
+ #include "xla/service/gpu/executable.pb.h"
28
+ #include "xla/service/gpu/gpu_executable.h"
29
+ #include "xla/service/hlo.pb.h"
30
+ #include "xla/service/hlo_dataflow_analysis.h"
31
+ #include "xla/statusor.h"
32
+ #include "xla/stream_executor/device_description.h"
33
+ #include "xla/stream_executor/stream_executor.h"
34
+ #include "xla/util.h"
35
+
36
+ namespace xla {
37
+ namespace gpu {
38
+
39
+ struct CompileModuleResults {
40
+ std::unique_ptr<llvm::Module> llvm_module;
41
+ std::unique_ptr<BufferAssignment> buffer_assignment;
42
+ std::vector<BufferAllocation> allocations;
43
+ std::variant<GpuExecutable::OwnedThunkSequence,
44
+ GpuExecutable::OwnedGpuRuntimeProgram,
45
+ GpuExecutable::OwnedGpu2RuntimeProgram>
46
+ executable;
47
+ EntryFunctionAttributes entry_func_attrs;
48
+ std::vector<GpuExecutable::ConstantInfo> constants;
49
+ absl::flat_hash_map<ShapeIndex, GpuExecutable::OutputInfo> output_info;
50
+ Shape output_shape;
51
+ std::string module_name;
52
+ };
53
+
54
+ // Removes all globals from the given module that are both uninitialized and
55
+ // have no uses within that module.
56
+ void RemoveUnusedAndUninitializedGlobals(
57
+ llvm::Module* llvm_module,
58
+ const std::vector<GpuExecutable::ConstantInfo>& constants);
59
+
60
+ // Compile `hlo_module` using XLA GPU and return the LLVM module thus generated.
61
+ // The GpuExecutable (and the Thunks that are part of it) are not returned.
62
+ StatusOr<std::unique_ptr<llvm::Module>> CompileModuleToLlvmIr(
63
+ HloModule* hlo_module, llvm::LLVMContext* llvm_context,
64
+ const std::string& target_triple, const std::string& data_layout,
65
+ const std::string& platform_name, se::Platform::Id platform_id,
66
+ const se::DeviceDescription& gpu_device_info,
67
+ const BufferValue::SizeFunction& buffer_size_bytes_function);
68
+
69
+ Status CompileModuleToLlvmIrImpl(
70
+ HloModule* hlo_module, llvm::LLVMContext* llvm_context,
71
+ const std::string& target_triple, const std::string& data_layout,
72
+ const std::string& platform_name, se::Platform::Id platform_id,
73
+ const se::DeviceDescription& gpu_device_info,
74
+ const HloDataflowAnalysis::CanShareBuffer& can_share_buffer_function,
75
+ const BufferValue::SizeFunction& buffer_size_bytes_function,
76
+ CompileModuleResults* results, se::StreamExecutor* stream_exec = nullptr);
77
+
78
+ } // namespace gpu
79
+ } // namespace xla
80
+
81
+ #endif // XLA_SERVICE_GPU_COMPILE_MODULE_TO_LLVM_IR_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conditional_thunk.h ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CONDITIONAL_THUNK_H_
17
+ #define XLA_SERVICE_GPU_CONDITIONAL_THUNK_H_
18
+
19
+ #include <memory>
20
+ #include <vector>
21
+
22
+ #include "absl/types/span.h"
23
+ #include "xla/hlo/ir/hlo_instruction.h"
24
+ #include "xla/service/gpu/buffer_allocations.h"
25
+ #include "xla/service/gpu/sequential_thunk.h"
26
+ #include "xla/service/gpu/thunk.h"
27
+ #include "xla/stream_executor/stream_executor.h"
28
+
29
+ namespace xla {
30
+ namespace gpu {
31
+
32
+ struct ConditionalThunkConfig {
33
+ bool branch_index_is_bool;
34
+ int64_t branch_count;
35
+ std::vector<std::unique_ptr<SequentialThunk>> branch_thunks;
36
+ };
37
+
38
+ // ConditionalThunk implements the conditional instruction on GPU by reading the
39
+ // predicate of the conditional and executing the true or the false computation
40
+ // depending on the value of the predicate.
41
+ //
42
+ // ConditionalThunk assumes that the buffers of the conditional result and the
43
+ // result of the true and false computations share the same allocation. Also,
44
+ // the buffers of the true operand of the conditional and that of the parameter
45
+ // instruction of the true computation share the same allocation. Similarly, the
46
+ // buffers of the false operand and that of the parameter instruction of the
47
+ // false computation share the same allocation.
48
+ class ConditionalThunk : public Thunk {
49
+ public:
50
+ ConditionalThunk(ThunkInfo thunk_info, ConditionalThunkConfig config,
51
+ const BufferAllocation::Slice& branch_index_buffer_index);
52
+
53
+ ConditionalThunk(const ConditionalThunk&) = delete;
54
+ ConditionalThunk& operator=(const ConditionalThunk&) = delete;
55
+
56
+ Status Initialize(const GpuExecutable& executable,
57
+ se::StreamExecutor* executor) override;
58
+ Status ExecuteOnStream(const ExecuteParams& params) override;
59
+
60
+ absl::Span<const std::unique_ptr<SequentialThunk>> branch_thunks() {
61
+ return config_.branch_thunks;
62
+ }
63
+
64
+ private:
65
+ const ConditionalThunkConfig config_;
66
+ BufferAllocation::Slice branch_index_buffer_index_;
67
+ };
68
+
69
+ } // namespace gpu
70
+ } // namespace xla
71
+
72
+ #endif // XLA_SERVICE_GPU_CONDITIONAL_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conv_algorithm_picker.h ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CONV_ALGORITHM_PICKER_H_
17
+ #define XLA_SERVICE_GPU_CONV_ALGORITHM_PICKER_H_
18
+
19
+ #include <optional>
20
+ #include <string>
21
+ #include <string_view>
22
+ #include <vector>
23
+
24
+ #include "xla/autotune_results.pb.h"
25
+ #include "xla/autotuning.pb.h"
26
+ #include "xla/hlo/ir/hlo_instructions.h"
27
+ #include "xla/hlo/ir/hlo_module.h"
28
+ #include "xla/service/gpu/autotuner_util.h"
29
+ #include "xla/service/gpu/gpu_conv_runner.h"
30
+ #include "xla/service/hlo_pass_interface.h"
31
+ #include "xla/service/service_executable_run_options.h"
32
+ #include "xla/stream_executor/device_memory_allocator.h"
33
+ #include "xla/stream_executor/stream_executor.h"
34
+
35
+ #if (defined(GOOGLE_CUDA) && GOOGLE_CUDA)
36
+ #include "xla/stream_executor/gpu/redzone_allocator.h"
37
+ #endif
38
+
39
+ namespace xla {
40
+ namespace gpu {
41
+
42
+ // Choose the fastest algorithm for each conv.
43
+ // Modifies CustomCalls to cudnn convolutions, choosing the best algorithm for
44
+ // each and adding explicit scratch space to the CustomCalls.
45
+ //
46
+ // We pick the algorithm before fusion so that we can generate better HLO. After
47
+ // GpuConvRewriter, our convolutions are CustomCalls which return a
48
+ // tuple (conv_result, scratch_memory), and the each conv uses 0 bytes of
49
+ // scratch:
50
+ //
51
+ // customcall = (f32[...], f32[0])
52
+ // return gte(customcall, 0)
53
+ //
54
+ // The algorithm picker then chooses the best algorithm, and potentially
55
+ // increases the scratch space. It replaces customcall with new_tuple,
56
+ // giving us the following:
57
+ //
58
+ // new_customcall = (f32[...], f32[N])
59
+ // new_tuple = tuple(gte(new_customcall, 0), constant f32[0])
60
+ // return gte(new_tuple, 0)
61
+ //
62
+ // The new tuple and gte instructions can be simplified away, because
63
+ // nobody is expected to use the scratch value.
64
+ //
65
+ // However, if we were to run GpuConvAlgorithmPicker after fusion
66
+ // the gte(customcall, 0) would probably already be into a fusion node. We
67
+ // can't simplify across HloComputation boundaries, so in this case we
68
+ // wouldn't be able to simplify away the new_tuple bits.
69
+ //
70
+ // It supports two modes: device and deviceless.
71
+ // In device mode, we run autotuning on the device and store autotune results.
72
+ //
73
+ // In deviceless mode, we pass in some information related to the device and
74
+ // use stored autotune results to rewrite convolutions. If the required autotune
75
+ // result is not stored, then the performance of convolution will be suboptimal.
76
+ class GpuConvAlgorithmPicker : public HloModulePass {
77
+ public:
78
+ explicit GpuConvAlgorithmPicker(AutotuneConfig config) : config_(config) {}
79
+
80
+ absl::string_view name() const override {
81
+ return "gpu-conv-algorithm-picker";
82
+ }
83
+
84
+ static bool IsEnabled(const HloModule* module) {
85
+ return module->config().debug_options().xla_gpu_autotune_level() != 0;
86
+ }
87
+
88
+ static bool IsCandidate(const HloInstruction* instr) {
89
+ return IsCustomCallToDnnConvolution(*instr);
90
+ }
91
+
92
+ using HloPassInterface::Run;
93
+ StatusOr<bool> Run(
94
+ HloModule* module,
95
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
96
+
97
+ // Run autotuning on allocated buffers and pick the best algorithm.
98
+ StatusOr<AutotuneResult> PickBestAlgorithmWithAllocatedBuffer(
99
+ const AutotuneConfig& config, GpuConvConfig conv_config,
100
+ const ServiceExecutableRunOptions* run_options,
101
+ const DebugOptions& debug_options,
102
+ std::vector<se::DeviceMemoryBase> buffers,
103
+ std::vector<se::DeviceMemoryBase> result_buffers);
104
+
105
+ private:
106
+ StatusOr<bool> RunOnComputation(HloComputation* computation);
107
+ StatusOr<bool> RunOnInstruction(HloInstruction* instr);
108
+
109
+ StatusOr<AutotuneResult> PickBestAlgorithm(
110
+ const HloCustomCallInstruction* instr);
111
+ StatusOr<AutotuneResult> PickBestAlgorithmNoCache(
112
+ const HloCustomCallInstruction* instr);
113
+
114
+ #if (defined(GOOGLE_CUDA) && GOOGLE_CUDA)
115
+ // Simple bundle of an algorithm and its output, for comparing results across
116
+ // autotuned algorithms.
117
+ struct ReferenceResult {
118
+ stream_executor::dnn::AlgorithmDesc algorithm;
119
+ std::vector<stream_executor::DeviceMemoryBase> buffers;
120
+ };
121
+
122
+ // Execution environment for autotuning. Runtime autotuning requires runtime
123
+ // information such as input/output buffers in order to run. It can be
124
+ // constructed from the autotuned instruction by FromInstruction.
125
+ struct AutotuneRuntimeArguments {
126
+ const Shape result_shape;
127
+ const HloModuleConfig hlo_module_config;
128
+ std::vector<se::DeviceMemoryBase> operand_buffers;
129
+ std::vector<se::DeviceMemoryBase> result_buffers;
130
+ se::RedzoneAllocator* input_output_allocator;
131
+ const GpuConvConfig gpu_conv_config;
132
+ std::optional<std::string> canonical_hlo;
133
+
134
+ static StatusOr<AutotuneRuntimeArguments> FromInstruction(
135
+ const HloCustomCallInstruction* instr,
136
+ se::DeviceMemoryAllocator* allocator, se::StreamExecutor* stream,
137
+ se::RedzoneAllocator* input_output_allocator);
138
+ };
139
+
140
+ StatusOr<AutotuneResult> AutotuneOneConvRunner(
141
+ se::Stream* stream, GenericConvRunner* runner,
142
+ std::optional<ReferenceResult>* reference_result,
143
+ absl::Span<const stream_executor::dnn::AlgorithmDesc> disabled_algos,
144
+ std::optional<AutotuneCacheKey> instruction_info,
145
+ const AutotuneRuntimeArguments& runtime_arguments);
146
+
147
+ // Pick the best algorithm for CUDA platform.
148
+ StatusOr<AutotuneResult> PickBestAlgorithmNoCacheCuda(
149
+ const HloCustomCallInstruction* instr, se::Stream* stream,
150
+ std::optional<AutotuneCacheKey> instruction_info,
151
+ const AutotuneRuntimeArguments& runtime_arguments);
152
+ #endif
153
+
154
+ StatusOr<AutotuneResult> PickBestAlgorithmNoCacheRocm(
155
+ const HloCustomCallInstruction* instr,
156
+ se::DeviceMemoryAllocator* allocator, se::Stream* stream);
157
+
158
+ private:
159
+ AutotuneConfig config_;
160
+ };
161
+
162
+ } // namespace gpu
163
+ } // namespace xla
164
+ #endif // XLA_SERVICE_GPU_CONV_ALGORITHM_PICKER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/conv_layout_normalization.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CONV_LAYOUT_NORMALIZATION_H_
17
+ #define XLA_SERVICE_GPU_CONV_LAYOUT_NORMALIZATION_H_
18
+
19
+ #include <functional>
20
+ #include <optional>
21
+ #include <utility>
22
+
23
+ #include "absl/strings/string_view.h"
24
+ #include "xla/hlo/ir/hlo_instruction.h"
25
+ #include "xla/hlo/ir/hlo_instructions.h"
26
+ #include "xla/statusor.h"
27
+
28
+ namespace xla {
29
+ namespace gpu {
30
+
31
+ StatusOr<std::optional<HloInstruction*>> NormalizeLayoutForGpuCustomCalls(
32
+ HloCustomCallInstruction*);
33
+
34
+ } // end namespace gpu
35
+ } // end namespace xla
36
+
37
+ #endif // XLA_SERVICE_GPU_CONV_LAYOUT_NORMALIZATION_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/convolution_thunk.h ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CONVOLUTION_THUNK_H_
17
+ #define XLA_SERVICE_GPU_CONVOLUTION_THUNK_H_
18
+
19
+ #include <memory>
20
+ #include <optional>
21
+
22
+ #include "absl/container/flat_hash_map.h"
23
+ #include "xla/hlo/ir/hlo_instruction.h"
24
+ #include "xla/hlo/ir/hlo_instructions.h"
25
+ #include "xla/service/buffer_assignment.h"
26
+ #include "xla/service/gpu/buffer_allocations.h"
27
+ #include "xla/service/gpu/gpu_conv_runner.h"
28
+ #include "xla/service/gpu/gpu_executable.h"
29
+ #include "xla/service/gpu/thunk.h"
30
+ #include "xla/stream_executor/stream_executor.h"
31
+ #include "xla/types.h"
32
+ #include "xla/xla_data.pb.h"
33
+ #include "tsl/platform/status.h"
34
+
35
+ namespace xla {
36
+ namespace gpu {
37
+
38
+ // This class stores everything that StreamExecutor needs to launch a DNN
39
+ // convolution. It is generated by IrEmitter.
40
+ //
41
+ // This is thread-compatible.
42
+ class ConvolutionThunk : public Thunk {
43
+ public:
44
+ // Constructs a thunk for launching a DNN convolution.
45
+ //
46
+ // operand_slices should be in the same order as cudnn_call->operands().
47
+ ConvolutionThunk(ThunkInfo thunk_info, GpuConvConfig config,
48
+ std::vector<BufferAllocation::Slice> operand_slices,
49
+ std::vector<BufferAllocation::Slice> result_slices,
50
+ BufferAllocation::Slice scratch_slice);
51
+
52
+ ConvolutionThunk(const ConvolutionThunk&) = delete;
53
+ ConvolutionThunk& operator=(const ConvolutionThunk&) = delete;
54
+
55
+ Status ExecuteOnStream(const ExecuteParams& params) override;
56
+
57
+ private:
58
+ std::vector<BufferAllocation::Slice> operand_buffers_;
59
+ std::vector<BufferAllocation::Slice> result_buffers_;
60
+ BufferAllocation::Slice scratch_buffer_;
61
+ GenericConvRunner& GetOrCreateRunner(const stream_executor::Stream* stream);
62
+
63
+ // Convolution config
64
+ const GpuConvConfig config_;
65
+ absl::Mutex mu_;
66
+ absl::flat_hash_map<const stream_executor::Stream*,
67
+ std::unique_ptr<GenericConvRunner>>
68
+ runner_cache_ ABSL_GUARDED_BY(mu_);
69
+ };
70
+
71
+ // Launches the kernel that reorders input data for int8x32 convolutions.
72
+ class ConvolutionReorderThunk : public Thunk {
73
+ public:
74
+ ConvolutionReorderThunk(ThunkInfo thunk_info, absl::Span<int64_t> filter_nchw,
75
+ std::vector<BufferAllocation::Slice> operand_slices,
76
+ std::vector<BufferAllocation::Slice> result_slices);
77
+
78
+ ConvolutionReorderThunk(const ConvolutionReorderThunk&) = delete;
79
+ ConvolutionReorderThunk& operator=(const ConvolutionReorderThunk&) = delete;
80
+
81
+ Status ExecuteOnStream(const ExecuteParams& params) override;
82
+
83
+ private:
84
+ static se::dnn::FilterDescriptor CreateFilterDescriptor(
85
+ absl::Span<int64_t> filter_nchw);
86
+
87
+ const se::dnn::FilterDescriptor filter_descriptor_;
88
+ std::vector<BufferAllocation::Slice> operand_buffers_;
89
+ std::vector<BufferAllocation::Slice> result_buffers_;
90
+ };
91
+
92
+ } // namespace gpu
93
+ } // namespace xla
94
+
95
+ #endif // XLA_SERVICE_GPU_CONVOLUTION_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/copy_fusion.h ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_COPY_FUSION_H_
17
+ #define XLA_SERVICE_GPU_COPY_FUSION_H_
18
+
19
+ #include "xla/hlo/ir/hlo_module.h"
20
+ #include "xla/service/hlo_pass_interface.h"
21
+ #include "xla/statusor.h"
22
+
23
+ namespace xla {
24
+ namespace gpu {
25
+
26
+ // CopyFusion checks if a fusion is followed by multiple copies and if so, adds
27
+ // those copies to the fusion, replacing the copies with get_tuple_elements.
28
+ class CopyFusion : public HloModulePass {
29
+ public:
30
+ CopyFusion() = default;
31
+
32
+ absl::string_view name() const override { return "copy_fusion"; }
33
+
34
+ using HloPassInterface::Run;
35
+ StatusOr<bool> Run(
36
+ HloModule* module,
37
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
38
+
39
+ private:
40
+ StatusOr<bool> DoCopyFusion(HloComputation* computation);
41
+ };
42
+
43
+ } // namespace gpu
44
+ } // namespace xla
45
+
46
+ #endif // XLA_SERVICE_GPU_COPY_FUSION_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/copy_thunk.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_COPY_THUNK_H_
17
+ #define XLA_SERVICE_GPU_COPY_THUNK_H_
18
+
19
+ #include "xla/hlo/ir/hlo_instruction.h"
20
+ #include "xla/service/buffer_assignment.h"
21
+ #include "xla/service/gpu/buffer_allocations.h"
22
+ #include "xla/service/gpu/thunk.h"
23
+ #include "xla/stream_executor/stream_executor.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ // A thunk that copies data from a device buffer to another device buffer.
29
+ class DeviceToDeviceCopyThunk : public Thunk {
30
+ public:
31
+ // Constructs a CopyThunk that copies host data from `source_buffer` to the
32
+ // device buffer `destination_buffer`. `mem_size` is the size of the data in
33
+ // bytes.
34
+ DeviceToDeviceCopyThunk(ThunkInfo thunk_info,
35
+ const BufferAllocation::Slice& source_buffer,
36
+ const BufferAllocation::Slice& destination_buffer,
37
+ uint64_t mem_size, mlir::Value source_value,
38
+ mlir::Value destination_value);
39
+
40
+ DeviceToDeviceCopyThunk(const DeviceToDeviceCopyThunk&) = delete;
41
+ DeviceToDeviceCopyThunk& operator=(const DeviceToDeviceCopyThunk&) = delete;
42
+
43
+ Status ExecuteOnStream(const ExecuteParams& params) override;
44
+
45
+ void ClearCompileTimeInfo() override {
46
+ Thunk::ClearCompileTimeInfo();
47
+ source_value_ = nullptr;
48
+ destination_value_ = nullptr;
49
+ }
50
+
51
+ const BufferAllocation::Slice& source() const { return source_buffer_; }
52
+ const BufferAllocation::Slice& destination() const {
53
+ return destination_buffer_;
54
+ }
55
+ uint64_t size_bytes() const { return mem_size_; }
56
+ mlir::Value source_value() const { return source_value_; }
57
+ mlir::Value destination_value() const { return destination_value_; }
58
+
59
+ private:
60
+ const BufferAllocation::Slice source_buffer_;
61
+ const BufferAllocation::Slice destination_buffer_;
62
+ const uint64_t mem_size_;
63
+ mlir::Value source_value_;
64
+ mlir::Value destination_value_;
65
+ };
66
+
67
+ } // namespace gpu
68
+ } // namespace xla
69
+
70
+ #endif // XLA_SERVICE_GPU_COPY_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_cudnn.h ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUBLAS_CUDNN_H_
17
+ #define XLA_SERVICE_GPU_CUBLAS_CUDNN_H_
18
+
19
+ #include "absl/strings/string_view.h"
20
+ #include "xla/hlo/ir/hlo_instructions.h"
21
+ #include "xla/hlo/ir/hlo_module.h"
22
+ #include "tsl/platform/statusor.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // Different types of convolutions supported by cudnn.
28
+ //
29
+ // A way to think about these is that a convolution is defined by three arrays
30
+ // -- the "input", the "filter", and the "output" -- and given any two of these,
31
+ // we can compute the third. For example, a backward-input convolution takes as
32
+ // input a filter and an "output" and produces an "input" such that if one were
33
+ // to do a forward convolution of "input" using filter, the result would be
34
+ // something with the same shape as "output".
35
+ //
36
+ // This way of thinking is not correct if you look at the values produced. For
37
+ // example, a backward-input convolution is not actually the mathematical
38
+ // inverse of a forward convolution. But it's right as far as the shapes and
39
+ // "connectivity" (i.e. which elements of the input affect which elements of
40
+ // the output) are concerned.
41
+ enum class CudnnConvKind {
42
+ kForward, // input + filter => output
43
+ kBackwardInput, // filter + output => input
44
+ kBackwardFilter, // input + output => filter
45
+ kForwardActivation, // activation(conv(input, filter) + broadcast(bias) +
46
+ // (optionally) side_input) => output
47
+ kForwardGraph, // pointwise(...pointwise(conv(input, filter))...)
48
+ // => output
49
+ };
50
+
51
+ enum class CudnnfMHAKind {
52
+ kBmmBmm,
53
+ kScaleBiasMaskSoftmax,
54
+ kScaleBiasMaskSoftmaxDropout,
55
+ kScaleMaskSoftmax,
56
+ kScaleMaskSoftmaxDropout,
57
+ kSoftmaxDropout,
58
+ kSoftmax,
59
+ kScaleBiasSoftmax,
60
+ kScaleBiasSoftmaxDropout,
61
+ kBackwardBmmBmm,
62
+ kBackwardScaleBiasMaskSoftmax,
63
+ kBackwardScaleBiasMaskSoftmaxDropout,
64
+ kBackwardScaleMaskSoftmax,
65
+ kBackwardScaleMaskSoftmaxDropout,
66
+ kBackwardSoftmaxDropout,
67
+ kBackwardSoftmax,
68
+ kBackwardScaleBiasSoftmax,
69
+ kBackwardScaleBiasSoftmaxDropout,
70
+ };
71
+
72
+ StatusOr<CudnnConvKind> GetCudnnConvKind(const HloCustomCallInstruction* instr);
73
+
74
+ // Converts a CudnnConvKind value to a string.
75
+ std::string CudnnConvKindToString(CudnnConvKind kind);
76
+
77
+ // Matrix multiplication rewritten into a GEMM custom call.
78
+ // All matrix multiplications should be rewritten as such custom calls
79
+ // after a GemmRewriter lowering pass.
80
+ bool IsCublasGemm(const HloInstruction& hlo);
81
+
82
+ // Matrix multiplication that calls into legacy cublas.
83
+ bool IsLegacyCublasMatmul(const HloInstruction& hlo);
84
+
85
+ // Matrix multiplication that calls into cublasLt.
86
+ bool IsCublasLtMatmul(const HloInstruction& hlo);
87
+
88
+ // Scaled matrix multiplication in FP8. Calls into cublasLt.
89
+ bool IsCublasLtMatmulF8(const HloInstruction& hlo);
90
+
91
+ // A call to cuBLAS general matrix multiplication API.
92
+ extern const absl::string_view kGemmCallTarget;
93
+
94
+ // A call to cuBLAS Lt API matrix multiplication.
95
+ extern const absl::string_view kCublasLtMatmulCallTarget;
96
+
97
+ // A call to cuBLASLt for scaled matrix multiplication in FP8.
98
+ extern const absl::string_view kCublasLtMatmulF8CallTarget;
99
+
100
+ // A call to cuBLAS for a triangular solve.
101
+ //
102
+ // Like cudnn convolutions, this op returns a tuple (result, scratch_memory).
103
+ extern const absl::string_view kTriangularSolveCallTarget;
104
+
105
+ // A call to cuDNN for convolution (forward, backward filter, or backward input)
106
+ // is represented as a CustomCall HLO with a call target equal to one of these
107
+ // strings.
108
+ //
109
+ // These CustomCalls have window() and convolution_dimension_numbers() set like
110
+ // regular convolution ops. They have the same LHS and RHS operands, plus two
111
+ // additional constant operands: an int64_t operand for the cudnn algorithm and
112
+ // a bool operand for whether tensor_ops is enabled. A value of -1 for the cudnn
113
+ // algorithm means that the implementation is free to choose the best algorithm
114
+ // it can.
115
+ //
116
+ // These calls output a tuple (conv_result, scratch_memory), where conv_result
117
+ // is the actual result of the convolution, and scratch_memory is temporary
118
+ // memory used by cudnn. Callers shouldn't inspect scratch_memory, as its value
119
+ // is not well-defined.
120
+ //
121
+ // GpuConvRewriter lowers kConvolution HLOs to these custom calls.
122
+ // When it does so, it chooses algorithm -1 and 0 bytes of scratch space. Later
123
+ // on in the pipeline, CudnnConvAlgorithmChooser chooses an explicit
124
+ // algorithm for each conv and sets the amount of scratch space needed.
125
+ //
126
+ // (Representing the scratch memory as an output may seem strange at first, but
127
+ // it's quite sensible, from a certain point of view. The scratch buffer is a
128
+ // location in memory that the conv can write into, but which it can't legally
129
+ // read from, at least until it's written something first. But that's exactly
130
+ // the definition of an output buffer.)
131
+ extern const absl::string_view kCudnnConvForwardCallTarget;
132
+ extern const absl::string_view kCudnnConvBackwardInputCallTarget;
133
+ extern const absl::string_view kCudnnConvBackwardFilterCallTarget;
134
+ extern const absl::string_view kCudnnConvBiasActivationForwardCallTarget;
135
+ extern const absl::string_view kCudnnConvForwardGraphCallTarget;
136
+
137
+ // cuDNN specific convolution helper (emitted together with a int8x32
138
+ // convolution, if reordering is required).
139
+ extern const absl::string_view kCudnnConvReorderFilterCallTarget;
140
+ extern const absl::string_view kCudnnConvReorderFilterAndBiasCallTarget;
141
+
142
+ // Returns true if `hlo` will be implemented as a call to a cuDNN convolution
143
+ // routine.
144
+ //
145
+ // This returns true if `hlo` is a CustomCall HLO with a call target equal to
146
+ // one of the kCudnnConvFoo constants above, but returns *false* for HLOs with a
147
+ // kConvolution opcode.
148
+ bool IsCustomCallToDnnConvolution(const HloInstruction& hlo);
149
+
150
+ // Returns true if `hlo` will be implemented as a call to cuDNN convolution
151
+ // reordering helper (required for int8x32 convolutions).
152
+ bool IsCudnnConvolutionReorder(const HloInstruction& hlo);
153
+
154
+ // The fused_mha_rewriter phase where each of the MHA signatures are pattern
155
+ // matched and rewritten into a custom-call with specific custom-call target.
156
+ // The custom-call target specifies the MHA signature. For example, BMM1 - Bias
157
+ // - Scale - Mask - Softmax - BMM2 pattern can have the target as
158
+ // cudnn$fmhaBiasScaleMaskSoftmax.
159
+ // The fMHA signatures currently supported by cudnn are:
160
+ // 1.BMM1 - BMM2
161
+ // 2. BMM1 - Scale - Bias - Mask - Softmax - BMM2
162
+ // 3. BMM1 - Scale - Bias - Mask - Softmax - Dropout - BMM2
163
+ // 4. BMM1 - Scale - Mask - Softmax - BMM2
164
+ // 5. BMM1 - Scale - Mask - Softmax - Dropout - BMM2
165
+ // 6. BMM1 - Softmax - Dropout - BMM2
166
+ // 7. BMM1 - Softmax - BMM2
167
+ // 8. BMM1 - scale - Bias - Softmax - BMM2
168
+ // Forward calls
169
+ extern const absl::string_view kCudnnfMHABmmBmmCallTarget;
170
+ extern const absl::string_view kCudnnfMHASoftmaxCallTarget;
171
+ extern const absl::string_view kCudnnfMHAScaleBiasMaskSoftmaxCallTarget;
172
+ extern const absl::string_view kCudnnfMHAScaleBiasMaskSoftmaxDropoutCallTarget;
173
+ extern const absl::string_view kCudnnfMHAScaleMaskSoftmaxCallTarget;
174
+ extern const absl::string_view kCudnnfMHAScaleMaskSoftmaxDropoutCallTarget;
175
+ extern const absl::string_view kCudnnfMHASoftmaxDropoutCallTarget;
176
+ extern const absl::string_view kCudnnfMHAScaleBiasSoftmaxDropoutCallTarget;
177
+ extern const absl::string_view kCudnnfMHAScaleBiasSoftmaxCallTarget;
178
+ // Backward calls
179
+ extern const absl::string_view kCudnnfMHABmmBmmBackwardCallTarget;
180
+ extern const absl::string_view kCudnnfMHASoftmaxBackwardCallTarget;
181
+ extern const absl::string_view kCudnnfMHAScaleBiasMaskSoftmaxBackwardCallTarget;
182
+ extern const absl::string_view
183
+ kCudnnfMHAScaleBiasMaskSoftmaxDropoutBackwardCallTarget;
184
+ extern const absl::string_view kCudnnfMHAScaleMaskSoftmaxBackwardCallTarget;
185
+ extern const absl::string_view
186
+ kCudnnfMHAScaleMaskSoftmaxDropoutBackwardCallTarget;
187
+ extern const absl::string_view kCudnnfMHASoftmaxDropoutBackwardCallTarget;
188
+ extern const absl::string_view
189
+ kCudnnfMHAScaleBiasSoftmaxDropoutBackwardCallTarget;
190
+ extern const absl::string_view kCudnnfMHAScaleBiasSoftmaxBackwardCallTarget;
191
+
192
+ bool IsFwdCustomCallTofMHA(const HloInstruction& hlo);
193
+ bool IsBwdCustomCallTofMHA(const HloInstruction& hlo);
194
+ bool IsCustomCallTofMHA(const HloInstruction& hlo);
195
+
196
+ StatusOr<CudnnfMHAKind> GetCudnnfMHAKind(const HloCustomCallInstruction* instr);
197
+
198
+ std::string CudnnfMHAKindToString(CudnnfMHAKind kind);
199
+ Status SetFMHAInstructionName(HloModule* module, HloInstruction* fmha);
200
+
201
+ bool MHACallHasDropout(absl::string_view fmha_call_name);
202
+ } // namespace gpu
203
+ } // namespace xla
204
+
205
+ #endif // XLA_SERVICE_GPU_CUBLAS_CUDNN_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_lt_matmul_thunk.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUBLAS_LT_MATMUL_THUNK_H_
17
+ #define XLA_SERVICE_GPU_CUBLAS_LT_MATMUL_THUNK_H_
18
+
19
+ #include <memory>
20
+ #include <optional>
21
+ #include <utility>
22
+
23
+ #include "xla/service/buffer_assignment.h"
24
+ #include "xla/service/gpu/matmul_utils.h"
25
+ #include "xla/service/gpu/thunk.h"
26
+ #include "xla/status.h"
27
+ #include "tsl/platform/statusor.h"
28
+ #if GOOGLE_CUDA
29
+ #include "xla/stream_executor/cuda/cuda_blas_lt.h"
30
+ #else
31
+ #include "rocm/rocm_config.h"
32
+ #include "xla/stream_executor/rocm/hip_blas_lt.h"
33
+ #endif // GOOGLE_CUDA
34
+
35
+ namespace xla {
36
+ namespace gpu {
37
+
38
+ class CublasLtMatmulThunk : public Thunk {
39
+ public:
40
+ CublasLtMatmulThunk(ThunkInfo thunk_info, GemmConfig gemm_config,
41
+ se::gpu::BlasLt::Epilogue epilogue, int64_t algorithm_idx,
42
+ BufferAllocation::Slice a_buffer,
43
+ BufferAllocation::Slice b_buffer,
44
+ BufferAllocation::Slice c_buffer,
45
+ BufferAllocation::Slice d_buffer,
46
+ BufferAllocation::Slice bias_buffer /* may be null */,
47
+ BufferAllocation::Slice aux_buffer /* may be null */,
48
+ BufferAllocation::Slice a_scale_buffer /* may be null */,
49
+ BufferAllocation::Slice b_scale_buffer /* may be null */,
50
+ BufferAllocation::Slice c_scale_buffer /* may be null */,
51
+ BufferAllocation::Slice d_scale_buffer /* may be null */,
52
+ BufferAllocation::Slice d_amax_buffer /* may be null */);
53
+
54
+ Status ExecuteOnStream(const ExecuteParams& params) override;
55
+
56
+ private:
57
+ StatusOr<cublas_lt::MatmulPlan*> GetMatmulPlan(
58
+ const stream_executor::Stream* stream);
59
+
60
+ absl::Mutex matmul_plans_cache_mutex_;
61
+ absl::flat_hash_map<const stream_executor::Stream*,
62
+ std::unique_ptr<cublas_lt::MatmulPlan>>
63
+ matmul_plans_cache_ ABSL_GUARDED_BY(matmul_plans_cache_mutex_);
64
+
65
+ GemmConfig gemm_config_;
66
+ se::gpu::BlasLt::Epilogue epilogue_;
67
+ int64_t algorithm_idx_;
68
+ BufferAllocation::Slice a_buffer_;
69
+ BufferAllocation::Slice b_buffer_;
70
+ BufferAllocation::Slice c_buffer_;
71
+ BufferAllocation::Slice d_buffer_;
72
+ BufferAllocation::Slice bias_buffer_;
73
+ BufferAllocation::Slice aux_buffer_;
74
+ BufferAllocation::Slice a_scale_buffer_;
75
+ BufferAllocation::Slice b_scale_buffer_;
76
+ BufferAllocation::Slice c_scale_buffer_;
77
+ BufferAllocation::Slice d_scale_buffer_;
78
+ BufferAllocation::Slice d_amax_buffer_;
79
+ std::optional<se::gpu::BlasLt::MatmulAlgorithm> algorithm_;
80
+ };
81
+
82
+ } // namespace gpu
83
+ } // namespace xla
84
+
85
+ #endif // XLA_SERVICE_GPU_CUBLAS_LT_MATMUL_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_pad_for_gemms.h ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUBLAS_PAD_FOR_GEMMS_H_
17
+ #define XLA_SERVICE_GPU_CUBLAS_PAD_FOR_GEMMS_H_
18
+
19
+ #include "xla/service/hlo_pass_interface.h"
20
+
21
+ namespace xla {
22
+ namespace gpu {
23
+
24
+ // Adds padding to dot operations to make them run faster on GPUs.
25
+ //
26
+ //
27
+ // This can be used to pad f16 dots on tensor cores, or s8 dots to multiples of
28
+ // four.
29
+ //
30
+ // This pass depends on xla::DotDecomposer pass,
31
+ // so it should go strictly later.
32
+ class CublasPadForGemms : public HloModulePass {
33
+ public:
34
+ CublasPadForGemms(const se::CudaComputeCapability cuda_compute_capability,
35
+ PrimitiveType datatype, int32_t pad_to_multiple_of)
36
+ : cuda_compute_capability_(cuda_compute_capability),
37
+ datatype_(datatype),
38
+ pad_to_multiple_of_(pad_to_multiple_of) {}
39
+
40
+ absl::string_view name() const override { return "cublas-pad-for-gemms"; }
41
+
42
+ using HloPassInterface::Run;
43
+ StatusOr<bool> Run(
44
+ HloModule* module,
45
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
46
+
47
+ private:
48
+ const se::CudaComputeCapability cuda_compute_capability_;
49
+ PrimitiveType datatype_;
50
+ int32_t pad_to_multiple_of_;
51
+ };
52
+
53
+ } // namespace gpu
54
+ } // namespace xla
55
+
56
+ #endif // XLA_SERVICE_GPU_CUBLAS_PAD_FOR_GEMMS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cublas_padding_requirements.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUBLAS_PADDING_REQUIREMENTS_H_
17
+ #define XLA_SERVICE_GPU_CUBLAS_PADDING_REQUIREMENTS_H_
18
+
19
+ #include <array>
20
+ #include <vector>
21
+
22
+ #include "xla/hlo/ir/hlo_instructions.h"
23
+ #include "xla/stream_executor/device_description.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ struct CublasPaddingRequirement {
29
+ int min_compute_capability;
30
+ PrimitiveType data_type;
31
+ int multiple_of;
32
+ };
33
+
34
+ // List of padding requirements per compute capability and data type.
35
+ constexpr std::array<CublasPaddingRequirement, 3> CublasPaddingRequirements{
36
+ {{se::CudaComputeCapability::VOLTA, S8, 4},
37
+ {se::CudaComputeCapability::VOLTA, F16, 8},
38
+ {se::CudaComputeCapability::AMPERE, BF16, 8}}};
39
+
40
+ // Tell if either of the operands of the dot requires padding.
41
+ bool CublasRequiresPadding(const HloDotInstruction& dot,
42
+ se::CudaComputeCapability cc);
43
+
44
+ } // namespace gpu
45
+ } // namespace xla
46
+
47
+ #endif // XLA_SERVICE_GPU_CUBLAS_PADDING_REQUIREMENTS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_conv_rewriter.h ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_FUSED_CONV_REWRITER_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_FUSED_CONV_REWRITER_H_
18
+
19
+ #include "xla/hlo/ir/hlo_instructions.h"
20
+ #include "xla/service/hlo_pass_interface.h"
21
+
22
+ namespace xla {
23
+ namespace gpu {
24
+
25
+ // Rewrites custom-calls targeting cudnnConvolutionForward to
26
+ // cudnnConvolutionBiasActivationForward by fusing operations following forward
27
+ // convolution. This transform must run after cudnn_conv_rewriter.
28
+ //
29
+ // Semantics of underlying cudnn ops:
30
+ //
31
+ // https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnConvolutionBiasActivationForward
32
+ // https://docs.nvidia.com/deeplearning/cudnn/developer-guide/index.html#scaling-parameters
33
+ //
34
+ // ## Floating-point convs
35
+ //
36
+ // A "complete" fused floating-point conv has the form
37
+ //
38
+ // max(0, alpha1 * conv(x, w) + alpha2 * side_input + broadcast(bias)),
39
+ //
40
+ // which we fuse to
41
+ //
42
+ // cudnnConvolutionBiasActivationForward(x, w, bias, side_input).
43
+ //
44
+ // You can leave out side_input, bias, alpha1, alpha2, and max(x, 0) and still
45
+ // get a fused convolution. alpha1/2 must be broadcasts of scalar constants.
46
+ //
47
+ // f16 convs accumulate in f32. We represent this in HLO as an f32 convolution
48
+ // whose inputs can be converted to f16 without loss of precision and whose
49
+ // output is immediately converted to f16. A fused f16 conv must follow one of
50
+ // the following idioms.
51
+ //
52
+ // 1. convert_f16(conv_f32(x_f32, w_f32)) +
53
+ // side_input_f16 + broadcast(bias_f16)
54
+ //
55
+ // 2. convert_f16(conv_f32(x_f32, w_f32) +
56
+ // side_input_f32 + broadcast(bias_f32))
57
+ //
58
+ // (These are not strictly mathematically equivalent, but cudnn doesn't tell us
59
+ // which one it does, and we deem them "close enough".)
60
+ //
61
+ // The foo_f32 HLOs must all be losslessly-convertible to f16. Some valid
62
+ // examples:
63
+ //
64
+ // - foo_f32 = convert_f32(foo_f16)
65
+ // - foo_f32 = an f32 constant whose values all fit within f16
66
+ // - foo_f32 = broadcast/transpose/reshape(one of the above)
67
+ //
68
+ // If you have a relu, it can appear before or after the convert_f16.
69
+ //
70
+ // Note that here `bias` must be losslessly-convertible to f16; this is
71
+ // different than for s8 convolutions, where bias is f32.
72
+ //
73
+ // ## Integer convs
74
+ //
75
+ // In pure HLO, a "complete" integer conv is spelled as one of the following
76
+ // `result`s.
77
+ //
78
+ // base = alpha1_f32 * convert_f32(conv_s32(input_s32, filter_s32)) +
79
+ // alpha2_f32 * side_input +
80
+ // bias_f32
81
+ //
82
+ // result_f32 = max(result_f32, 0)
83
+ // result_s8_option1 = max(convert_s8(clamp(-128, base, 127)), 0)
84
+ // result_s8_option2 = convert_s8(clamp(-128, max(base, 0), 127))
85
+ //
86
+ // The foo_s32 HLOs must be losslessly-convertible to s8. If the `result_s8`
87
+ // case, side_input should be an f32 HLO that's losslessly-convertible to s8;
88
+ // otherwise, it should be losslessly-convertible to f32.
89
+ //
90
+ // In the `result_s8` case where there's no bias, side-input, or alpha1, you can
91
+ // skip the convert_f32 on conv.
92
+ //
93
+ // If you have an integer convolution that doesn't fit one of these idioms, this
94
+ // pass returns an error -- cudnn will not be able to run it.
95
+ class CudnnFusedConvRewriter : public HloModulePass {
96
+ public:
97
+ explicit CudnnFusedConvRewriter(se::CudaComputeCapability cc)
98
+ : compute_capability_(cc) {}
99
+
100
+ absl::string_view name() const override {
101
+ return "cudnn-fused-convolution-rewriter";
102
+ }
103
+
104
+ using HloPassInterface::Run;
105
+ StatusOr<bool> Run(
106
+ HloModule* module,
107
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
108
+
109
+ private:
110
+ const se::CudaComputeCapability compute_capability_;
111
+ };
112
+
113
+ } // namespace gpu
114
+ } // namespace xla
115
+
116
+ #endif // XLA_SERVICE_GPU_CUDNN_FUSED_CONV_REWRITER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_mha_rewriter.h ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_FUSED_MHA_REWRITER_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_FUSED_MHA_REWRITER_H_
18
+
19
+ #include "xla/hlo/ir/hlo_instructions.h"
20
+ #include "xla/service/hlo_pass_interface.h"
21
+ #include "xla/stream_executor/dnn.h"
22
+
23
+ namespace xla {
24
+ namespace gpu {
25
+
26
+ class CudnnFusedMHARewriter : public HloModulePass {
27
+ public:
28
+ explicit CudnnFusedMHARewriter(se::CudaComputeCapability cc,
29
+ se::StreamExecutor* stream_executor)
30
+ : compute_capability_(cc), stream_executor_(stream_executor) {}
31
+
32
+ explicit CudnnFusedMHARewriter(se::CudaComputeCapability cc,
33
+ se::dnn::VersionInfo cudnn_version)
34
+ : compute_capability_(cc), cudnn_version_(cudnn_version) {}
35
+
36
+ absl::string_view name() const override {
37
+ return "cudnn-fused-multi-headed-attention-rewriter";
38
+ }
39
+
40
+ using HloPassInterface::Run;
41
+ StatusOr<bool> Run(
42
+ HloModule* module,
43
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
44
+
45
+ private:
46
+ const se::CudaComputeCapability compute_capability_;
47
+ se::StreamExecutor* stream_executor_ = nullptr;
48
+ const se::dnn::VersionInfo cudnn_version_;
49
+ };
50
+
51
+ } // namespace gpu
52
+ } // namespace xla
53
+
54
+ #endif // XLA_SERVICE_GPU_CUDNN_FUSED_MHA_REWRITER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_fused_mha_transpose_fusion.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_FUSED_MHA_TRANSPOSE_FUSION_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_FUSED_MHA_TRANSPOSE_FUSION_H_
18
+
19
+ #include "xla/hlo/ir/hlo_instructions.h"
20
+ #include "xla/service/hlo_pass_interface.h"
21
+
22
+ namespace xla {
23
+ namespace gpu {
24
+
25
+ class CudnnFusedMHATransposeFusion : public HloModulePass {
26
+ public:
27
+ CudnnFusedMHATransposeFusion() = default;
28
+
29
+ absl::string_view name() const override {
30
+ return "cudnn-fused-multi-headed-attention-transpose-fusion";
31
+ }
32
+
33
+ using HloPassInterface::Run;
34
+ StatusOr<bool> Run(
35
+ HloModule* module,
36
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
37
+ };
38
+
39
+ } // namespace gpu
40
+ } // namespace xla
41
+
42
+ #endif // XLA_SERVICE_GPU_CUDNN_FUSED_MHA_TRANSPOSE_FUSION_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_pad_for_convolutions.h ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_PAD_FOR_CONVOLUTIONS_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_PAD_FOR_CONVOLUTIONS_H_
18
+
19
+ #include "xla/hlo/ir/hlo_casting_utils.h"
20
+ #include "xla/literal_util.h"
21
+ #include "xla/service/gpu/ir_emission_utils.h"
22
+ #include "xla/service/hlo_pass_interface.h"
23
+ #include "xla/util.h"
24
+ #include "xla/window_util.h"
25
+
26
+ namespace xla {
27
+ namespace gpu {
28
+
29
+ // Two zero-paddings for CuDNN thunking are done in this transform: padding for
30
+ // tensor cores and padding for integer convolutions. This transform also
31
+ // add slice instruction to remove unnecessary output features.
32
+ class CudnnPadForConvolutions : public HloModulePass {
33
+ public:
34
+ explicit CudnnPadForConvolutions(se::CudaComputeCapability compute_capability)
35
+ : compute_capability_(compute_capability) {}
36
+
37
+ absl::string_view name() const override {
38
+ return "cudnn_pad_for_convolutions";
39
+ }
40
+ // Run PadForConvolutions on the given module and return if any change is made
41
+ using HloPassInterface::Run;
42
+ StatusOr<bool> Run(
43
+ HloModule* module,
44
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
45
+
46
+ private:
47
+ const se::CudaComputeCapability compute_capability_;
48
+ };
49
+
50
+ } // namespace gpu
51
+ } // namespace xla
52
+
53
+ #endif // XLA_SERVICE_GPU_CUDNN_PAD_FOR_CONVOLUTIONS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_simplify_padding.h ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_SIMPLIFY_PADDING_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_SIMPLIFY_PADDING_H_
18
+
19
+ #include "xla/service/hlo_pass_interface.h"
20
+ #include "xla/statusor.h"
21
+
22
+ namespace xla::gpu {
23
+
24
+ // Simplifies or eliminates padding introduced by CudnnPadForConvolutions and
25
+ // CudnnVectorizeConvolutions.
26
+ //
27
+ // CudnnVectorizeConvolutions will generate code that does the following.
28
+ // - pad input and output features to a multiple of 32 (or 4),
29
+ // - reshape input from [N,C,H,W] to [N,C/32,H,W,32] and reshape kernel from
30
+ // [I,O,H,W] to [I/32,32,O,H,W],
31
+ // - run the conv,
32
+ // - reshape output from [N,C/32,H,W,32] to [N,C,H,W], and finally
33
+ // - slice off the padding on the C channel.
34
+ //
35
+ // But if this is followed by another convolution (very common), then the slice
36
+ // is immediately followed by another pad. This may be redundant; we know that
37
+ // the trailing channels sliced off from the first conv are 0.
38
+ //
39
+ // Ideally we can eliminate the whole reshape+slice+pad+reshape sequence between
40
+ // the two convolutions.
41
+ //
42
+ // Specifically, this pass tries to merge the slice at the end of the sequence
43
+ // above into the pad from the next convolution (when we can prove that the
44
+ // sliced-off elements are all 0). We then rely on algsimp to remove the pad if
45
+ // it's a nop and then to merge and eliminate the remaining reshapes.
46
+ //
47
+ // This pass should run after CudnnVectorizeConvolutions and there should be no
48
+ // simplification passes in between that modify the reshape-transpose-reshape
49
+ // introduced by int8x32 convolution filter reordering.
50
+ class CudnnSimplifyPadding : public HloModulePass {
51
+ public:
52
+ CudnnSimplifyPadding() = default;
53
+
54
+ absl::string_view name() const override { return "cudnn_simplify_padding"; }
55
+
56
+ using HloPassInterface::Run;
57
+ StatusOr<bool> Run(
58
+ HloModule* module,
59
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
60
+ };
61
+
62
+ } // namespace xla::gpu
63
+
64
+ #endif // XLA_SERVICE_GPU_CUDNN_SIMPLIFY_PADDING_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_support_utils.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_SUPPORT_UTILS_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_SUPPORT_UTILS_H_
18
+
19
+ #include <vector>
20
+
21
+ #include "xla/hlo/ir/hlo_instructions.h"
22
+ #include "xla/shape.h"
23
+ #include "xla/stream_executor/device_description.h"
24
+ #include "tsl/platform/status.h"
25
+
26
+ namespace xla {
27
+ namespace gpu {
28
+
29
+ // Indicates whether the `compute_capability` supports an optimized integer
30
+ // implementation of the given `conv` operation vectorized to `vector_size`.
31
+ //
32
+ // This function does not guarantee that a convolution will be padded and/or
33
+ // vectorized. It only checks that it is a valid candiate for such optimization.
34
+ StatusOr<bool> CudnnSupportsOptimizedIntegerConvolution(
35
+ const se::CudaComputeCapability& compute_capability,
36
+ HloCustomCallInstruction& conv, int vector_size);
37
+
38
+ // Represents configuration for the reshape-transpose-reshape operations that
39
+ // are equivalent to `cudnnReorderFilterAndBias`. This is used by int8x32
40
+ // vectorized convolutions.
41
+ //
42
+ // For filter reordering the equivalent HLO is:
43
+ // %reshape = s8[$S] reshape(%input)
44
+ // %transpose = s8[I/32,H,W,O/8,2,8,4,4] transpose(%reshape), dimensions={$D}
45
+ // %result = s8[O,I/32,H,W,32] reshape(%transpose)
46
+ //
47
+ // For bias reordering the HLO is similar, but the op shapes are s8[O/32,4,2,4]
48
+ // for %transpose, and s8[O/32,2,4,4] for %result.
49
+ //
50
+ // The helper functions below calculate the shape $S (transpose_shape) and
51
+ // dimensions $D (permutation) from the convolution dimensions numbers config.
52
+ // The result_shape is fixed and is present for the convenience.
53
+ struct CudnnReorderTransposeConfig {
54
+ Shape transpose_shape;
55
+ Shape result_shape;
56
+ std::vector<int64_t> permutation;
57
+ };
58
+
59
+ // Create a transposition for an int8x32 convolution filter that effectively
60
+ // does the same thing as cudnnReorderFilterAndBias, but could also be constant
61
+ // folded or fused.
62
+ StatusOr<CudnnReorderTransposeConfig> CudnnInferTransposeForFilterReordering(
63
+ const Shape& shape, const ConvolutionDimensionNumbers& dimension_numbers);
64
+
65
+ // Create a transposition for an int8x32 convolution bias that effectively
66
+ // does the same thing as cudnnReorderFilterAndBias, but could also be constant
67
+ // folded or fused.
68
+ StatusOr<CudnnReorderTransposeConfig> CudnnInferTransposeForBiasReordering(
69
+ const Shape& shape);
70
+
71
+ } // namespace gpu
72
+ } // namespace xla
73
+
74
+ #endif // XLA_SERVICE_GPU_CUDNN_SUPPORT_UTILS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cudnn_vectorize_convolutions.h ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUDNN_VECTORIZE_CONVOLUTIONS_H_
17
+ #define XLA_SERVICE_GPU_CUDNN_VECTORIZE_CONVOLUTIONS_H_
18
+
19
+ #include <utility>
20
+
21
+ #include "xla/service/hlo_pass_interface.h"
22
+ #include "xla/statusor.h"
23
+ #include "xla/stream_executor/dnn.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ // Changes the shape of cudnn convolutions to allow faster "vectorized"
29
+ // algorithms.
30
+ //
31
+ // On sm61+ will convert int8_t convolutions from
32
+ //
33
+ // - [N, C, H, W] to [N, C/4, H, W, 4],
34
+ //
35
+ // assuming C is divisible by 4.
36
+ //
37
+ // On sm75+ will convert int8_t convolutions from
38
+ //
39
+ // - [N, C, H, W] to [N, C/32, H, W, 32],
40
+ // - [N, C/4, H, W, 4] to [N, C/32, H, W, 32], and
41
+ // - [N, C, H, W] to [N, C/4, H, W, 4] (same as sm61+),
42
+ //
43
+ // assuming C is divisible by 4 or 32.
44
+ //
45
+ // This pass will not pad the channel dim to a multiple of 4 or 32, so you
46
+ // should run CudnnPadForConvolutions before this.
47
+ class CudnnVectorizeConvolutions : public HloModulePass {
48
+ public:
49
+ explicit CudnnVectorizeConvolutions(
50
+ se::CudaComputeCapability compute_capability,
51
+ se::dnn::VersionInfo cudnn_version)
52
+ : compute_capability_(compute_capability),
53
+ cudnn_version_(cudnn_version) {}
54
+
55
+ absl::string_view name() const override {
56
+ return "cudnn_vectorize_convolutions";
57
+ }
58
+ using HloPassInterface::Run;
59
+ StatusOr<bool> Run(
60
+ HloModule* module,
61
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
62
+
63
+ private:
64
+ const se::CudaComputeCapability compute_capability_;
65
+ const se::dnn::VersionInfo cudnn_version_;
66
+ };
67
+
68
+ } // namespace gpu
69
+ } // namespace xla
70
+
71
+ #endif // XLA_SERVICE_GPU_CUDNN_VECTORIZE_CONVOLUTIONS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cusolver_context.h ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUSOLVER_CONTEXT_H_
17
+ #define XLA_SERVICE_GPU_CUSOLVER_CONTEXT_H_
18
+
19
+ #include <complex>
20
+ #include <memory>
21
+
22
+ #define TENSORFLOW_USE_HIPSOLVER \
23
+ (TENSORFLOW_USE_ROCM && (TF_ROCM_VERSION >= 40500))
24
+ #define TENSORFLOW_USE_ROCSOLVER \
25
+ (TENSORFLOW_USE_ROCM && (TF_ROCM_VERSION < 40500))
26
+ #define TENSORFLOW_USE_CUSOLVER_OR_HIPSOLVER \
27
+ (!TENSORFLOW_USE_ROCM || TENSORFLOW_USE_HIPSOLVER)
28
+
29
+ #if !TENSORFLOW_USE_ROCM
30
+ #include "third_party/gpus/cuda/include/cusolverDn.h"
31
+ using gpusolverHandle_t = cusolverDnHandle_t;
32
+ #else
33
+ #include "rocm/rocm_config.h"
34
+ // Macros to ease the transition from rocsolver to hipsolver.
35
+ #if TENSORFLOW_USE_HIPSOLVER
36
+ #include "xla/stream_executor/rocm/hipsolver_wrapper.h"
37
+ using gpusolverHandle_t = hipsolverHandle_t;
38
+ #else // TENSORFLOW_USE_ROCSOLVER
39
+ #include "xla/stream_executor/rocm/rocblas_wrapper.h"
40
+ #include "xla/stream_executor/rocm/rocsolver_wrapper.h"
41
+ using gpusolverHandle_t = rocblas_handle;
42
+ #endif // TF_ROCM_VERSION >= 40500
43
+ #endif // TENSORFLOW_USE_ROCM
44
+
45
+ #include "xla/statusor.h"
46
+ #include "xla/stream_executor/blas.h"
47
+ #include "xla/stream_executor/stream_executor.h"
48
+ #include "xla/xla_data.pb.h"
49
+
50
+ namespace xla {
51
+ namespace gpu {
52
+
53
+ namespace se = ::stream_executor;
54
+
55
+ class GpuSolverContext {
56
+ public:
57
+ static StatusOr<GpuSolverContext> Create();
58
+
59
+ Status SetStream(se::Stream* stream);
60
+
61
+ // Computes the Cholesky factorization of multiple matrices. See
62
+ // https://docs.nvidia.com/cuda/cusolver/index.html#cuSolverDN-lt-t-gt-batchpotrf
63
+ //
64
+ // `as` is a list of pointers to the batch_size individual n x n matricies
65
+ // that make up the input array.
66
+ Status PotrfBatched(se::blas::UpperLower uplo, int n,
67
+ se::DeviceMemory<float*> as, int lda,
68
+ se::DeviceMemory<int> lapack_info, int batch_size);
69
+ Status PotrfBatched(se::blas::UpperLower uplo, int n,
70
+ se::DeviceMemory<double*> as, int lda,
71
+ se::DeviceMemory<int> lapack_info, int batch_size);
72
+ Status PotrfBatched(se::blas::UpperLower uplo, int n,
73
+ se::DeviceMemory<std::complex<float>*> as, int lda,
74
+ se::DeviceMemory<int> lapack_info, int batch_size);
75
+ Status PotrfBatched(se::blas::UpperLower uplo, int n,
76
+ se::DeviceMemory<std::complex<double>*> as, int lda,
77
+ se::DeviceMemory<int> lapack_info, int batch_size);
78
+
79
+ // Returns the max size of the `workspace` required by Potrf and PotrfBatched,
80
+ // in number of elements of `type`.
81
+ //
82
+ // (cusolver's PotrfBatched doesn't require a workspace per se -- it uses the
83
+ // input array as scratch. But we do need to materialize the `as` input, and
84
+ // we do this in the workspace.)
85
+ //
86
+ // This is a bit of a hack; we could instead split it up into two functions.
87
+ // But at the moment, it's an implementation detail of CholeskyThunk whether
88
+ // it calls Potrf or PotrfBatched, so we need to allocate enough scratch space
89
+ // for either.
90
+ //
91
+ // In practice, this does not result in a notable increase in scratch space
92
+ // needed, because both cases require a relatively small amount of scratch.
93
+ StatusOr<int64_t> PotrfBufferSize(PrimitiveType type,
94
+ se::blas::UpperLower uplo, int n, int lda,
95
+ int batch_size);
96
+
97
+ private:
98
+ explicit GpuSolverContext(gpusolverHandle_t handle);
99
+
100
+ struct Deleter {
101
+ void operator()(gpusolverHandle_t handle);
102
+ };
103
+
104
+ std::unique_ptr<std::remove_pointer_t<gpusolverHandle_t>, Deleter> handle_;
105
+ };
106
+
107
+ } // namespace gpu
108
+ } // namespace xla
109
+
110
+ #endif // XLA_SERVICE_GPU_CUSOLVER_CONTEXT_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/cusolver_rewriter.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUSOLVER_REWRITER_H_
17
+ #define XLA_SERVICE_GPU_CUSOLVER_REWRITER_H_
18
+
19
+ #include "xla/hlo/ir/hlo_computation.h"
20
+ #include "xla/hlo/ir/hlo_module.h"
21
+ #include "xla/service/gpu/cusolver_context.h"
22
+ #include "xla/service/hlo_pass_interface.h"
23
+ #include "xla/stream_executor/device_memory_allocator.h"
24
+ #include "xla/stream_executor/stream_executor.h"
25
+
26
+ namespace xla {
27
+ namespace gpu {
28
+
29
+ // Rewrites Cholesky calls into CustomCall HLOs that call into cuSolver.
30
+ class GpusolverRewriter : public HloModulePass {
31
+ public:
32
+ GpusolverRewriter();
33
+ absl::string_view name() const override { return "gpusolver-rewriter"; }
34
+
35
+ using HloPassInterface::Run;
36
+ StatusOr<bool> Run(
37
+ HloModule* module,
38
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
39
+
40
+ private:
41
+ StatusOr<bool> RunOnComputation(HloComputation* computation);
42
+ };
43
+
44
+ } // namespace gpu
45
+ } // namespace xla
46
+
47
+ #endif // XLA_SERVICE_GPU_CUSOLVER_REWRITER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/custom_call_thunk.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_CUSTOM_CALL_THUNK_H_
17
+ #define XLA_SERVICE_GPU_CUSTOM_CALL_THUNK_H_
18
+
19
+ #include "xla/service/custom_call_status_internal.h"
20
+ #include "xla/service/gpu/buffer_allocations.h"
21
+ #include "xla/service/gpu/thunk.h"
22
+
23
+ #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
24
+ #include "xla/stream_executor/gpu/gpu_types.h"
25
+ #endif
26
+
27
+ namespace xla {
28
+ namespace gpu {
29
+
30
+ // Thunk to run a GPU custom call.
31
+ //
32
+ // This thunk's `ExecuteOnStream` implementation executes a host function
33
+ // `call_target` which is expected to enqueue operations onto the GPU.
34
+ //
35
+ // Note that not all kCustomCall HLOs in XLA:GPU end up being run by this thunk.
36
+ // XLA itself creates kCustomCall instructions when lowering kConvolution HLOs
37
+ // into calls to cudnn. These internally-created custom-calls are run using
38
+ // ConvolutionThunk, not CustomCallThunk. There's no ambiguity because they
39
+ // have special call target names (e.g. "__cudnn$convForward") that only the
40
+ // compiler is allowed to create.
41
+ class CustomCallThunk : public Thunk {
42
+ public:
43
+ using OptionalSlice = ::std::optional<BufferAllocation::Slice>;
44
+
45
+ #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
46
+ using Stream = stream_executor::gpu::GpuStreamHandle;
47
+ #else // GOOGLE_CUDA || TENSORFLOW_USE_ROCM
48
+ using Stream = void*;
49
+ #endif // GOOGLE_CUDA || TENSORFLOW_USE_ROCM
50
+
51
+ using CustomCallTarget = std::function<void(Stream, void**, const char*,
52
+ size_t, XlaCustomCallStatus*)>;
53
+ CustomCallThunk(ThunkInfo thunk_info, CustomCallTarget call_target,
54
+ std::vector<OptionalSlice> operands,
55
+ std::vector<OptionalSlice> results,
56
+ const std::string& opaque);
57
+
58
+ Status ExecuteOnStream(const ExecuteParams& params) override;
59
+
60
+ private:
61
+ const CustomCallTarget call_target_;
62
+ const std::vector<OptionalSlice> operands_;
63
+ const std::vector<OptionalSlice> results_;
64
+ const std::string opaque_;
65
+ };
66
+
67
+ } // namespace gpu
68
+ } // namespace xla
69
+
70
+ #endif // XLA_SERVICE_GPU_CUSTOM_CALL_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/dot_dimension_sorter.h ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_DOT_DIMENSION_SORTER_H_
17
+ #define XLA_SERVICE_GPU_DOT_DIMENSION_SORTER_H_
18
+
19
+ #include "xla/hlo/ir/hlo_module.h"
20
+ #include "xla/service/hlo_pass_interface.h"
21
+
22
+ namespace xla {
23
+ namespace gpu {
24
+
25
+ // Sorts contracting dimensions of dot() operands when this reduces the
26
+ // number of transposes. Example:
27
+ // dot(p0, p1), lhs_contracting_dims={3,2}, rhs_contracting_dims={2,1} ->
28
+ // dot(p0, p1), lhs_contracting_dims={2,3}, rhs_contracting_dims={1,2}
29
+ // The first case gets transposes inserted by dot_decomposer, the second one
30
+ // does not and thus is generally more efficient.
31
+
32
+ // TODO(b/265688934): do the same for batch dimensions?
33
+
34
+ class DotDimensionSorter : public HloModulePass {
35
+ public:
36
+ absl::string_view name() const override { return "dot_dimension_sorter"; }
37
+
38
+ // Run the pass on computations in 'module'.
39
+ // Returns whether the 'module' was changed.
40
+ using HloPassInterface::Run;
41
+ StatusOr<bool> Run(
42
+ HloModule* module,
43
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
44
+ };
45
+
46
+ } // namespace gpu
47
+ } // namespace xla
48
+
49
+ #endif // XLA_SERVICE_GPU_DOT_DIMENSION_SORTER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/elemental_ir_emitter.h ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_ELEMENTAL_IR_EMITTER_H_
17
+ #define XLA_SERVICE_GPU_ELEMENTAL_IR_EMITTER_H_
18
+
19
+ #include <string>
20
+
21
+ #include "absl/types/span.h"
22
+ #include "llvm/IR/IRBuilder.h"
23
+ #include "llvm/IR/Value.h"
24
+ #include "xla/hlo/ir/hlo_computation.h"
25
+ #include "xla/hlo/ir/hlo_instruction.h"
26
+ #include "xla/service/elemental_ir_emitter.h"
27
+ #include "xla/service/gpu/ir_emitter_context.h"
28
+ #include "xla/service/gpu/target_util.h"
29
+ #include "xla/service/hlo_module_config.h"
30
+ #include "xla/statusor.h"
31
+ #include "xla/xla_data.pb.h"
32
+
33
+ namespace xla {
34
+ namespace gpu {
35
+
36
+ class GpuElementalIrEmitter : public ElementalIrEmitter {
37
+ public:
38
+ GpuElementalIrEmitter(IrEmitterContext& ir_emitter_context,
39
+ llvm::IRBuilder<>* b);
40
+
41
+ protected:
42
+ llvm_ir::IrArray::Index GetSourceIndexOfBitcast(
43
+ const llvm_ir::IrArray::Index& index, const HloInstruction* hlo) override;
44
+
45
+ StatusOr<llvm::Value*> EmitFloatBinaryOp(const HloInstruction* op,
46
+ llvm::Value* lhs_value,
47
+ llvm::Value* rhs_value) override;
48
+
49
+ StatusOr<llvm::Value*> EmitLog(PrimitiveType prim_type,
50
+ llvm::Value* value) override;
51
+
52
+ StatusOr<llvm::Value*> EmitLog1p(PrimitiveType prim_type,
53
+ llvm::Value* value) override;
54
+
55
+ StatusOr<llvm::Value*> EmitSin(PrimitiveType prim_type,
56
+ llvm::Value* value) override;
57
+
58
+ StatusOr<llvm::Value*> EmitCos(PrimitiveType prim_type,
59
+ llvm::Value* value) override;
60
+
61
+ StatusOr<llvm::Value*> EmitTan(PrimitiveType prim_type,
62
+ llvm::Value* value) override;
63
+
64
+ StatusOr<llvm::Value*> EmitExp(PrimitiveType prim_type, llvm::Value* value,
65
+ absl::string_view name) override;
66
+
67
+ StatusOr<llvm::Value*> EmitExpm1(PrimitiveType prim_type,
68
+ llvm::Value* value) override;
69
+
70
+ StatusOr<llvm::Value*> EmitSqrt(PrimitiveType prim_type,
71
+ llvm::Value* value) override;
72
+
73
+ StatusOr<llvm::Value*> EmitRsqrt(PrimitiveType prim_type,
74
+ llvm::Value* value) override;
75
+
76
+ StatusOr<llvm::Value*> EmitPow(PrimitiveType prim_type, llvm::Value* lhs,
77
+ llvm::Value* rhs,
78
+ absl::string_view name) override;
79
+
80
+ StatusOr<llvm::Value*> EmitAtan2(PrimitiveType prim_type, llvm::Value* lhs,
81
+ llvm::Value* rhs,
82
+ absl::string_view name) override;
83
+
84
+ StatusOr<llvm::Value*> EmitTanh(PrimitiveType prim_type,
85
+ llvm::Value* value) override;
86
+
87
+ StatusOr<llvm::Value*> EmitComplexAbs(PrimitiveType prim_type,
88
+ llvm::Value* value) override;
89
+
90
+ StatusOr<llvm::Value*> EmitCbrt(PrimitiveType prim_type,
91
+ llvm::Value* value) override;
92
+
93
+ StatusOr<std::vector<llvm::Value*>> EmitThreadLocalCall(
94
+ const HloComputation& callee, absl::Span<llvm::Value* const> parameters,
95
+ absl::string_view, bool /*is_reducer*/) override;
96
+
97
+ llvm::Value* EmitThreadId() override;
98
+
99
+ bool fast_min_max() override {
100
+ return ir_emitter_context_.debug_options().xla_gpu_enable_fast_min_max();
101
+ }
102
+
103
+ private:
104
+ // Emits IR for op, which must have opcode kPower.
105
+ StatusOr<llvm::Value*> EmitPowerOp(const HloInstruction* op,
106
+ llvm::Value* lhs_value,
107
+ llvm::Value* rhs_value);
108
+
109
+ // Emits IR to call an LLVM intrinsic of type [T] -> T. Adjusts
110
+ // callee_name according to T. Returns the IR value that represents the
111
+ // return value of the function.
112
+ StatusOr<llvm::Value*> EmitLlvmIntrinsicMathCall(
113
+ const std::string& callee_name, absl::Span<llvm::Value* const> operands,
114
+ absl::Span<const PrimitiveType> input_types, PrimitiveType output_type);
115
+
116
+ // Emits IR to call a device function of type [T] -> T. Adjusts
117
+ // callee_name according to T. Returns the IR value that represents the
118
+ // return value of the function.
119
+ StatusOr<llvm::Value*> EmitDeviceMathCall(
120
+ TargetDeviceFunctionID funcid, absl::Span<llvm::Value* const> operands,
121
+ absl::Span<const PrimitiveType> input_types, PrimitiveType output_type,
122
+ absl::string_view name = "");
123
+
124
+ // Emits IR to call a function of type [T] -> T. Does not munge callee_name.
125
+ // Returns the IR value that represents the return value of the function.
126
+ StatusOr<llvm::Value*> EmitMathCall(
127
+ const std::string& callee_name, absl::Span<llvm::Value* const> operands,
128
+ absl::Span<const PrimitiveType> input_types, PrimitiveType output_type,
129
+ absl::string_view name = "");
130
+
131
+ IrEmitterContext& ir_emitter_context_;
132
+ };
133
+
134
+ } // namespace gpu
135
+ } // namespace xla
136
+
137
+ #endif // XLA_SERVICE_GPU_ELEMENTAL_IR_EMITTER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/executable.pb.h ADDED
@@ -0,0 +1,935 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ // source: xla/service/gpu/executable.proto
3
+
4
+ #ifndef GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fexecutable_2eproto
5
+ #define GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fexecutable_2eproto
6
+
7
+ #include <limits>
8
+ #include <string>
9
+
10
+ #include <google/protobuf/port_def.inc>
11
+ #if PROTOBUF_VERSION < 3021000
12
+ #error This file was generated by a newer version of protoc which is
13
+ #error incompatible with your Protocol Buffer headers. Please update
14
+ #error your headers.
15
+ #endif
16
+ #if 3021009 < PROTOBUF_MIN_PROTOC_VERSION
17
+ #error This file was generated by an older version of protoc which is
18
+ #error incompatible with your Protocol Buffer headers. Please
19
+ #error regenerate this file with a newer version of protoc.
20
+ #endif
21
+
22
+ #include <google/protobuf/port_undef.inc>
23
+ #include <google/protobuf/io/coded_stream.h>
24
+ #include <google/protobuf/arena.h>
25
+ #include <google/protobuf/arenastring.h>
26
+ #include <google/protobuf/generated_message_util.h>
27
+ #include <google/protobuf/metadata_lite.h>
28
+ #include <google/protobuf/generated_message_reflection.h>
29
+ #include <google/protobuf/message.h>
30
+ #include <google/protobuf/repeated_field.h> // IWYU pragma: export
31
+ #include <google/protobuf/extension_set.h> // IWYU pragma: export
32
+ #include <google/protobuf/unknown_field_set.h>
33
+ #include "xla/service/hlo.pb.h"
34
+ // @@protoc_insertion_point(includes)
35
+ #include <google/protobuf/port_def.inc>
36
+ #define PROTOBUF_INTERNAL_EXPORT_xla_2fservice_2fgpu_2fexecutable_2eproto
37
+ PROTOBUF_NAMESPACE_OPEN
38
+ namespace internal {
39
+ class AnyMetadata;
40
+ } // namespace internal
41
+ PROTOBUF_NAMESPACE_CLOSE
42
+
43
+ // Internal implementation detail -- do not use these members.
44
+ struct TableStruct_xla_2fservice_2fgpu_2fexecutable_2eproto {
45
+ static const uint32_t offsets[];
46
+ };
47
+ extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_xla_2fservice_2fgpu_2fexecutable_2eproto;
48
+ namespace xla {
49
+ namespace gpu {
50
+ class XlaRuntimeGpuExecutableProto;
51
+ struct XlaRuntimeGpuExecutableProtoDefaultTypeInternal;
52
+ extern XlaRuntimeGpuExecutableProtoDefaultTypeInternal _XlaRuntimeGpuExecutableProto_default_instance_;
53
+ class XlaRuntimeGpuExecutableProto_ConstantInfoProto;
54
+ struct XlaRuntimeGpuExecutableProto_ConstantInfoProtoDefaultTypeInternal;
55
+ extern XlaRuntimeGpuExecutableProto_ConstantInfoProtoDefaultTypeInternal _XlaRuntimeGpuExecutableProto_ConstantInfoProto_default_instance_;
56
+ } // namespace gpu
57
+ } // namespace xla
58
+ PROTOBUF_NAMESPACE_OPEN
59
+ template<> ::xla::gpu::XlaRuntimeGpuExecutableProto* Arena::CreateMaybeMessage<::xla::gpu::XlaRuntimeGpuExecutableProto>(Arena*);
60
+ template<> ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* Arena::CreateMaybeMessage<::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto>(Arena*);
61
+ PROTOBUF_NAMESPACE_CLOSE
62
+ namespace xla {
63
+ namespace gpu {
64
+
65
+ // ===================================================================
66
+
67
+ class XlaRuntimeGpuExecutableProto_ConstantInfoProto final :
68
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto) */ {
69
+ public:
70
+ inline XlaRuntimeGpuExecutableProto_ConstantInfoProto() : XlaRuntimeGpuExecutableProto_ConstantInfoProto(nullptr) {}
71
+ ~XlaRuntimeGpuExecutableProto_ConstantInfoProto() override;
72
+ explicit PROTOBUF_CONSTEXPR XlaRuntimeGpuExecutableProto_ConstantInfoProto(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
73
+
74
+ XlaRuntimeGpuExecutableProto_ConstantInfoProto(const XlaRuntimeGpuExecutableProto_ConstantInfoProto& from);
75
+ XlaRuntimeGpuExecutableProto_ConstantInfoProto(XlaRuntimeGpuExecutableProto_ConstantInfoProto&& from) noexcept
76
+ : XlaRuntimeGpuExecutableProto_ConstantInfoProto() {
77
+ *this = ::std::move(from);
78
+ }
79
+
80
+ inline XlaRuntimeGpuExecutableProto_ConstantInfoProto& operator=(const XlaRuntimeGpuExecutableProto_ConstantInfoProto& from) {
81
+ CopyFrom(from);
82
+ return *this;
83
+ }
84
+ inline XlaRuntimeGpuExecutableProto_ConstantInfoProto& operator=(XlaRuntimeGpuExecutableProto_ConstantInfoProto&& from) noexcept {
85
+ if (this == &from) return *this;
86
+ if (GetOwningArena() == from.GetOwningArena()
87
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
88
+ && GetOwningArena() != nullptr
89
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
90
+ ) {
91
+ InternalSwap(&from);
92
+ } else {
93
+ CopyFrom(from);
94
+ }
95
+ return *this;
96
+ }
97
+
98
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
99
+ return GetDescriptor();
100
+ }
101
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
102
+ return default_instance().GetMetadata().descriptor;
103
+ }
104
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
105
+ return default_instance().GetMetadata().reflection;
106
+ }
107
+ static const XlaRuntimeGpuExecutableProto_ConstantInfoProto& default_instance() {
108
+ return *internal_default_instance();
109
+ }
110
+ static inline const XlaRuntimeGpuExecutableProto_ConstantInfoProto* internal_default_instance() {
111
+ return reinterpret_cast<const XlaRuntimeGpuExecutableProto_ConstantInfoProto*>(
112
+ &_XlaRuntimeGpuExecutableProto_ConstantInfoProto_default_instance_);
113
+ }
114
+ static constexpr int kIndexInFileMessages =
115
+ 0;
116
+
117
+ friend void swap(XlaRuntimeGpuExecutableProto_ConstantInfoProto& a, XlaRuntimeGpuExecutableProto_ConstantInfoProto& b) {
118
+ a.Swap(&b);
119
+ }
120
+ inline void Swap(XlaRuntimeGpuExecutableProto_ConstantInfoProto* other) {
121
+ if (other == this) return;
122
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
123
+ if (GetOwningArena() != nullptr &&
124
+ GetOwningArena() == other->GetOwningArena()) {
125
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
126
+ if (GetOwningArena() == other->GetOwningArena()) {
127
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
128
+ InternalSwap(other);
129
+ } else {
130
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
131
+ }
132
+ }
133
+ void UnsafeArenaSwap(XlaRuntimeGpuExecutableProto_ConstantInfoProto* other) {
134
+ if (other == this) return;
135
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
136
+ InternalSwap(other);
137
+ }
138
+
139
+ // implements Message ----------------------------------------------
140
+
141
+ XlaRuntimeGpuExecutableProto_ConstantInfoProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
142
+ return CreateMaybeMessage<XlaRuntimeGpuExecutableProto_ConstantInfoProto>(arena);
143
+ }
144
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
145
+ void CopyFrom(const XlaRuntimeGpuExecutableProto_ConstantInfoProto& from);
146
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
147
+ void MergeFrom( const XlaRuntimeGpuExecutableProto_ConstantInfoProto& from) {
148
+ XlaRuntimeGpuExecutableProto_ConstantInfoProto::MergeImpl(*this, from);
149
+ }
150
+ private:
151
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
152
+ public:
153
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
154
+ bool IsInitialized() const final;
155
+
156
+ size_t ByteSizeLong() const final;
157
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
158
+ uint8_t* _InternalSerialize(
159
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
160
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
161
+
162
+ private:
163
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
164
+ void SharedDtor();
165
+ void SetCachedSize(int size) const final;
166
+ void InternalSwap(XlaRuntimeGpuExecutableProto_ConstantInfoProto* other);
167
+
168
+ private:
169
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
170
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
171
+ return "xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto";
172
+ }
173
+ protected:
174
+ explicit XlaRuntimeGpuExecutableProto_ConstantInfoProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
175
+ bool is_message_owned = false);
176
+ public:
177
+
178
+ static const ClassData _class_data_;
179
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
180
+
181
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
182
+
183
+ // nested types ----------------------------------------------------
184
+
185
+ // accessors -------------------------------------------------------
186
+
187
+ enum : int {
188
+ kSymbolNameFieldNumber = 1,
189
+ kContentFieldNumber = 2,
190
+ kAllocationIndexFieldNumber = 3,
191
+ };
192
+ // string symbol_name = 1;
193
+ void clear_symbol_name();
194
+ const std::string& symbol_name() const;
195
+ template <typename ArgT0 = const std::string&, typename... ArgT>
196
+ void set_symbol_name(ArgT0&& arg0, ArgT... args);
197
+ std::string* mutable_symbol_name();
198
+ PROTOBUF_NODISCARD std::string* release_symbol_name();
199
+ void set_allocated_symbol_name(std::string* symbol_name);
200
+ private:
201
+ const std::string& _internal_symbol_name() const;
202
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_symbol_name(const std::string& value);
203
+ std::string* _internal_mutable_symbol_name();
204
+ public:
205
+
206
+ // bytes content = 2;
207
+ void clear_content();
208
+ const std::string& content() const;
209
+ template <typename ArgT0 = const std::string&, typename... ArgT>
210
+ void set_content(ArgT0&& arg0, ArgT... args);
211
+ std::string* mutable_content();
212
+ PROTOBUF_NODISCARD std::string* release_content();
213
+ void set_allocated_content(std::string* content);
214
+ private:
215
+ const std::string& _internal_content() const;
216
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_content(const std::string& value);
217
+ std::string* _internal_mutable_content();
218
+ public:
219
+
220
+ // int32 allocation_index = 3;
221
+ void clear_allocation_index();
222
+ int32_t allocation_index() const;
223
+ void set_allocation_index(int32_t value);
224
+ private:
225
+ int32_t _internal_allocation_index() const;
226
+ void _internal_set_allocation_index(int32_t value);
227
+ public:
228
+
229
+ // @@protoc_insertion_point(class_scope:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto)
230
+ private:
231
+ class _Internal;
232
+
233
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
234
+ typedef void InternalArenaConstructable_;
235
+ typedef void DestructorSkippable_;
236
+ struct Impl_ {
237
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr symbol_name_;
238
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr content_;
239
+ int32_t allocation_index_;
240
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
241
+ };
242
+ union { Impl_ _impl_; };
243
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fexecutable_2eproto;
244
+ };
245
+ // -------------------------------------------------------------------
246
+
247
+ class XlaRuntimeGpuExecutableProto final :
248
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.XlaRuntimeGpuExecutableProto) */ {
249
+ public:
250
+ inline XlaRuntimeGpuExecutableProto() : XlaRuntimeGpuExecutableProto(nullptr) {}
251
+ ~XlaRuntimeGpuExecutableProto() override;
252
+ explicit PROTOBUF_CONSTEXPR XlaRuntimeGpuExecutableProto(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
253
+
254
+ XlaRuntimeGpuExecutableProto(const XlaRuntimeGpuExecutableProto& from);
255
+ XlaRuntimeGpuExecutableProto(XlaRuntimeGpuExecutableProto&& from) noexcept
256
+ : XlaRuntimeGpuExecutableProto() {
257
+ *this = ::std::move(from);
258
+ }
259
+
260
+ inline XlaRuntimeGpuExecutableProto& operator=(const XlaRuntimeGpuExecutableProto& from) {
261
+ CopyFrom(from);
262
+ return *this;
263
+ }
264
+ inline XlaRuntimeGpuExecutableProto& operator=(XlaRuntimeGpuExecutableProto&& from) noexcept {
265
+ if (this == &from) return *this;
266
+ if (GetOwningArena() == from.GetOwningArena()
267
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
268
+ && GetOwningArena() != nullptr
269
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
270
+ ) {
271
+ InternalSwap(&from);
272
+ } else {
273
+ CopyFrom(from);
274
+ }
275
+ return *this;
276
+ }
277
+
278
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
279
+ return GetDescriptor();
280
+ }
281
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
282
+ return default_instance().GetMetadata().descriptor;
283
+ }
284
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
285
+ return default_instance().GetMetadata().reflection;
286
+ }
287
+ static const XlaRuntimeGpuExecutableProto& default_instance() {
288
+ return *internal_default_instance();
289
+ }
290
+ static inline const XlaRuntimeGpuExecutableProto* internal_default_instance() {
291
+ return reinterpret_cast<const XlaRuntimeGpuExecutableProto*>(
292
+ &_XlaRuntimeGpuExecutableProto_default_instance_);
293
+ }
294
+ static constexpr int kIndexInFileMessages =
295
+ 1;
296
+
297
+ friend void swap(XlaRuntimeGpuExecutableProto& a, XlaRuntimeGpuExecutableProto& b) {
298
+ a.Swap(&b);
299
+ }
300
+ inline void Swap(XlaRuntimeGpuExecutableProto* other) {
301
+ if (other == this) return;
302
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
303
+ if (GetOwningArena() != nullptr &&
304
+ GetOwningArena() == other->GetOwningArena()) {
305
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
306
+ if (GetOwningArena() == other->GetOwningArena()) {
307
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
308
+ InternalSwap(other);
309
+ } else {
310
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
311
+ }
312
+ }
313
+ void UnsafeArenaSwap(XlaRuntimeGpuExecutableProto* other) {
314
+ if (other == this) return;
315
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
316
+ InternalSwap(other);
317
+ }
318
+
319
+ // implements Message ----------------------------------------------
320
+
321
+ XlaRuntimeGpuExecutableProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
322
+ return CreateMaybeMessage<XlaRuntimeGpuExecutableProto>(arena);
323
+ }
324
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
325
+ void CopyFrom(const XlaRuntimeGpuExecutableProto& from);
326
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
327
+ void MergeFrom( const XlaRuntimeGpuExecutableProto& from) {
328
+ XlaRuntimeGpuExecutableProto::MergeImpl(*this, from);
329
+ }
330
+ private:
331
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
332
+ public:
333
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
334
+ bool IsInitialized() const final;
335
+
336
+ size_t ByteSizeLong() const final;
337
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
338
+ uint8_t* _InternalSerialize(
339
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
340
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
341
+
342
+ private:
343
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
344
+ void SharedDtor();
345
+ void SetCachedSize(int size) const final;
346
+ void InternalSwap(XlaRuntimeGpuExecutableProto* other);
347
+
348
+ private:
349
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
350
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
351
+ return "xla.gpu.XlaRuntimeGpuExecutableProto";
352
+ }
353
+ protected:
354
+ explicit XlaRuntimeGpuExecutableProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
355
+ bool is_message_owned = false);
356
+ public:
357
+
358
+ static const ClassData _class_data_;
359
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
360
+
361
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
362
+
363
+ // nested types ----------------------------------------------------
364
+
365
+ typedef XlaRuntimeGpuExecutableProto_ConstantInfoProto ConstantInfoProto;
366
+
367
+ // accessors -------------------------------------------------------
368
+
369
+ enum : int {
370
+ kConstantsFieldNumber = 5,
371
+ kGpuAsmTextFieldNumber = 3,
372
+ kGpuBinaryFieldNumber = 4,
373
+ kXlaRuntimeExecutableFieldNumber = 1,
374
+ kEntryFuncAttrsFieldNumber = 2,
375
+ };
376
+ // repeated .xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto constants = 5;
377
+ int constants_size() const;
378
+ private:
379
+ int _internal_constants_size() const;
380
+ public:
381
+ void clear_constants();
382
+ ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* mutable_constants(int index);
383
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto >*
384
+ mutable_constants();
385
+ private:
386
+ const ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto& _internal_constants(int index) const;
387
+ ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* _internal_add_constants();
388
+ public:
389
+ const ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto& constants(int index) const;
390
+ ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* add_constants();
391
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto >&
392
+ constants() const;
393
+
394
+ // string gpu_asm_text = 3;
395
+ void clear_gpu_asm_text();
396
+ const std::string& gpu_asm_text() const;
397
+ template <typename ArgT0 = const std::string&, typename... ArgT>
398
+ void set_gpu_asm_text(ArgT0&& arg0, ArgT... args);
399
+ std::string* mutable_gpu_asm_text();
400
+ PROTOBUF_NODISCARD std::string* release_gpu_asm_text();
401
+ void set_allocated_gpu_asm_text(std::string* gpu_asm_text);
402
+ private:
403
+ const std::string& _internal_gpu_asm_text() const;
404
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_gpu_asm_text(const std::string& value);
405
+ std::string* _internal_mutable_gpu_asm_text();
406
+ public:
407
+
408
+ // bytes gpu_binary = 4;
409
+ void clear_gpu_binary();
410
+ const std::string& gpu_binary() const;
411
+ template <typename ArgT0 = const std::string&, typename... ArgT>
412
+ void set_gpu_binary(ArgT0&& arg0, ArgT... args);
413
+ std::string* mutable_gpu_binary();
414
+ PROTOBUF_NODISCARD std::string* release_gpu_binary();
415
+ void set_allocated_gpu_binary(std::string* gpu_binary);
416
+ private:
417
+ const std::string& _internal_gpu_binary() const;
418
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_gpu_binary(const std::string& value);
419
+ std::string* _internal_mutable_gpu_binary();
420
+ public:
421
+
422
+ // .xla.XlaRuntimeExecutableProto xla_runtime_executable = 1;
423
+ bool has_xla_runtime_executable() const;
424
+ private:
425
+ bool _internal_has_xla_runtime_executable() const;
426
+ public:
427
+ void clear_xla_runtime_executable();
428
+ const ::xla::XlaRuntimeExecutableProto& xla_runtime_executable() const;
429
+ PROTOBUF_NODISCARD ::xla::XlaRuntimeExecutableProto* release_xla_runtime_executable();
430
+ ::xla::XlaRuntimeExecutableProto* mutable_xla_runtime_executable();
431
+ void set_allocated_xla_runtime_executable(::xla::XlaRuntimeExecutableProto* xla_runtime_executable);
432
+ private:
433
+ const ::xla::XlaRuntimeExecutableProto& _internal_xla_runtime_executable() const;
434
+ ::xla::XlaRuntimeExecutableProto* _internal_mutable_xla_runtime_executable();
435
+ public:
436
+ void unsafe_arena_set_allocated_xla_runtime_executable(
437
+ ::xla::XlaRuntimeExecutableProto* xla_runtime_executable);
438
+ ::xla::XlaRuntimeExecutableProto* unsafe_arena_release_xla_runtime_executable();
439
+
440
+ // .xla.EntryFunctionAttributes entry_func_attrs = 2;
441
+ bool has_entry_func_attrs() const;
442
+ private:
443
+ bool _internal_has_entry_func_attrs() const;
444
+ public:
445
+ void clear_entry_func_attrs();
446
+ const ::xla::EntryFunctionAttributes& entry_func_attrs() const;
447
+ PROTOBUF_NODISCARD ::xla::EntryFunctionAttributes* release_entry_func_attrs();
448
+ ::xla::EntryFunctionAttributes* mutable_entry_func_attrs();
449
+ void set_allocated_entry_func_attrs(::xla::EntryFunctionAttributes* entry_func_attrs);
450
+ private:
451
+ const ::xla::EntryFunctionAttributes& _internal_entry_func_attrs() const;
452
+ ::xla::EntryFunctionAttributes* _internal_mutable_entry_func_attrs();
453
+ public:
454
+ void unsafe_arena_set_allocated_entry_func_attrs(
455
+ ::xla::EntryFunctionAttributes* entry_func_attrs);
456
+ ::xla::EntryFunctionAttributes* unsafe_arena_release_entry_func_attrs();
457
+
458
+ // @@protoc_insertion_point(class_scope:xla.gpu.XlaRuntimeGpuExecutableProto)
459
+ private:
460
+ class _Internal;
461
+
462
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
463
+ typedef void InternalArenaConstructable_;
464
+ typedef void DestructorSkippable_;
465
+ struct Impl_ {
466
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto > constants_;
467
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr gpu_asm_text_;
468
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr gpu_binary_;
469
+ ::xla::XlaRuntimeExecutableProto* xla_runtime_executable_;
470
+ ::xla::EntryFunctionAttributes* entry_func_attrs_;
471
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
472
+ };
473
+ union { Impl_ _impl_; };
474
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fexecutable_2eproto;
475
+ };
476
+ // ===================================================================
477
+
478
+
479
+ // ===================================================================
480
+
481
+ #ifdef __GNUC__
482
+ #pragma GCC diagnostic push
483
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
484
+ #endif // __GNUC__
485
+ // XlaRuntimeGpuExecutableProto_ConstantInfoProto
486
+
487
+ // string symbol_name = 1;
488
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::clear_symbol_name() {
489
+ _impl_.symbol_name_.ClearToEmpty();
490
+ }
491
+ inline const std::string& XlaRuntimeGpuExecutableProto_ConstantInfoProto::symbol_name() const {
492
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.symbol_name)
493
+ return _internal_symbol_name();
494
+ }
495
+ template <typename ArgT0, typename... ArgT>
496
+ inline PROTOBUF_ALWAYS_INLINE
497
+ void XlaRuntimeGpuExecutableProto_ConstantInfoProto::set_symbol_name(ArgT0&& arg0, ArgT... args) {
498
+
499
+ _impl_.symbol_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
500
+ // @@protoc_insertion_point(field_set:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.symbol_name)
501
+ }
502
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::mutable_symbol_name() {
503
+ std::string* _s = _internal_mutable_symbol_name();
504
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.symbol_name)
505
+ return _s;
506
+ }
507
+ inline const std::string& XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_symbol_name() const {
508
+ return _impl_.symbol_name_.Get();
509
+ }
510
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_set_symbol_name(const std::string& value) {
511
+
512
+ _impl_.symbol_name_.Set(value, GetArenaForAllocation());
513
+ }
514
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_mutable_symbol_name() {
515
+
516
+ return _impl_.symbol_name_.Mutable(GetArenaForAllocation());
517
+ }
518
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::release_symbol_name() {
519
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.symbol_name)
520
+ return _impl_.symbol_name_.Release();
521
+ }
522
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::set_allocated_symbol_name(std::string* symbol_name) {
523
+ if (symbol_name != nullptr) {
524
+
525
+ } else {
526
+
527
+ }
528
+ _impl_.symbol_name_.SetAllocated(symbol_name, GetArenaForAllocation());
529
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
530
+ if (_impl_.symbol_name_.IsDefault()) {
531
+ _impl_.symbol_name_.Set("", GetArenaForAllocation());
532
+ }
533
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
534
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.symbol_name)
535
+ }
536
+
537
+ // bytes content = 2;
538
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::clear_content() {
539
+ _impl_.content_.ClearToEmpty();
540
+ }
541
+ inline const std::string& XlaRuntimeGpuExecutableProto_ConstantInfoProto::content() const {
542
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.content)
543
+ return _internal_content();
544
+ }
545
+ template <typename ArgT0, typename... ArgT>
546
+ inline PROTOBUF_ALWAYS_INLINE
547
+ void XlaRuntimeGpuExecutableProto_ConstantInfoProto::set_content(ArgT0&& arg0, ArgT... args) {
548
+
549
+ _impl_.content_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
550
+ // @@protoc_insertion_point(field_set:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.content)
551
+ }
552
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::mutable_content() {
553
+ std::string* _s = _internal_mutable_content();
554
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.content)
555
+ return _s;
556
+ }
557
+ inline const std::string& XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_content() const {
558
+ return _impl_.content_.Get();
559
+ }
560
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_set_content(const std::string& value) {
561
+
562
+ _impl_.content_.Set(value, GetArenaForAllocation());
563
+ }
564
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_mutable_content() {
565
+
566
+ return _impl_.content_.Mutable(GetArenaForAllocation());
567
+ }
568
+ inline std::string* XlaRuntimeGpuExecutableProto_ConstantInfoProto::release_content() {
569
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.content)
570
+ return _impl_.content_.Release();
571
+ }
572
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::set_allocated_content(std::string* content) {
573
+ if (content != nullptr) {
574
+
575
+ } else {
576
+
577
+ }
578
+ _impl_.content_.SetAllocated(content, GetArenaForAllocation());
579
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
580
+ if (_impl_.content_.IsDefault()) {
581
+ _impl_.content_.Set("", GetArenaForAllocation());
582
+ }
583
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
584
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.content)
585
+ }
586
+
587
+ // int32 allocation_index = 3;
588
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::clear_allocation_index() {
589
+ _impl_.allocation_index_ = 0;
590
+ }
591
+ inline int32_t XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_allocation_index() const {
592
+ return _impl_.allocation_index_;
593
+ }
594
+ inline int32_t XlaRuntimeGpuExecutableProto_ConstantInfoProto::allocation_index() const {
595
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.allocation_index)
596
+ return _internal_allocation_index();
597
+ }
598
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::_internal_set_allocation_index(int32_t value) {
599
+
600
+ _impl_.allocation_index_ = value;
601
+ }
602
+ inline void XlaRuntimeGpuExecutableProto_ConstantInfoProto::set_allocation_index(int32_t value) {
603
+ _internal_set_allocation_index(value);
604
+ // @@protoc_insertion_point(field_set:xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto.allocation_index)
605
+ }
606
+
607
+ // -------------------------------------------------------------------
608
+
609
+ // XlaRuntimeGpuExecutableProto
610
+
611
+ // .xla.XlaRuntimeExecutableProto xla_runtime_executable = 1;
612
+ inline bool XlaRuntimeGpuExecutableProto::_internal_has_xla_runtime_executable() const {
613
+ return this != internal_default_instance() && _impl_.xla_runtime_executable_ != nullptr;
614
+ }
615
+ inline bool XlaRuntimeGpuExecutableProto::has_xla_runtime_executable() const {
616
+ return _internal_has_xla_runtime_executable();
617
+ }
618
+ inline const ::xla::XlaRuntimeExecutableProto& XlaRuntimeGpuExecutableProto::_internal_xla_runtime_executable() const {
619
+ const ::xla::XlaRuntimeExecutableProto* p = _impl_.xla_runtime_executable_;
620
+ return p != nullptr ? *p : reinterpret_cast<const ::xla::XlaRuntimeExecutableProto&>(
621
+ ::xla::_XlaRuntimeExecutableProto_default_instance_);
622
+ }
623
+ inline const ::xla::XlaRuntimeExecutableProto& XlaRuntimeGpuExecutableProto::xla_runtime_executable() const {
624
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.xla_runtime_executable)
625
+ return _internal_xla_runtime_executable();
626
+ }
627
+ inline void XlaRuntimeGpuExecutableProto::unsafe_arena_set_allocated_xla_runtime_executable(
628
+ ::xla::XlaRuntimeExecutableProto* xla_runtime_executable) {
629
+ if (GetArenaForAllocation() == nullptr) {
630
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.xla_runtime_executable_);
631
+ }
632
+ _impl_.xla_runtime_executable_ = xla_runtime_executable;
633
+ if (xla_runtime_executable) {
634
+
635
+ } else {
636
+
637
+ }
638
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.xla_runtime_executable)
639
+ }
640
+ inline ::xla::XlaRuntimeExecutableProto* XlaRuntimeGpuExecutableProto::release_xla_runtime_executable() {
641
+
642
+ ::xla::XlaRuntimeExecutableProto* temp = _impl_.xla_runtime_executable_;
643
+ _impl_.xla_runtime_executable_ = nullptr;
644
+ #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
645
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
646
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
647
+ if (GetArenaForAllocation() == nullptr) { delete old; }
648
+ #else // PROTOBUF_FORCE_COPY_IN_RELEASE
649
+ if (GetArenaForAllocation() != nullptr) {
650
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
651
+ }
652
+ #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
653
+ return temp;
654
+ }
655
+ inline ::xla::XlaRuntimeExecutableProto* XlaRuntimeGpuExecutableProto::unsafe_arena_release_xla_runtime_executable() {
656
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.xla_runtime_executable)
657
+
658
+ ::xla::XlaRuntimeExecutableProto* temp = _impl_.xla_runtime_executable_;
659
+ _impl_.xla_runtime_executable_ = nullptr;
660
+ return temp;
661
+ }
662
+ inline ::xla::XlaRuntimeExecutableProto* XlaRuntimeGpuExecutableProto::_internal_mutable_xla_runtime_executable() {
663
+
664
+ if (_impl_.xla_runtime_executable_ == nullptr) {
665
+ auto* p = CreateMaybeMessage<::xla::XlaRuntimeExecutableProto>(GetArenaForAllocation());
666
+ _impl_.xla_runtime_executable_ = p;
667
+ }
668
+ return _impl_.xla_runtime_executable_;
669
+ }
670
+ inline ::xla::XlaRuntimeExecutableProto* XlaRuntimeGpuExecutableProto::mutable_xla_runtime_executable() {
671
+ ::xla::XlaRuntimeExecutableProto* _msg = _internal_mutable_xla_runtime_executable();
672
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.xla_runtime_executable)
673
+ return _msg;
674
+ }
675
+ inline void XlaRuntimeGpuExecutableProto::set_allocated_xla_runtime_executable(::xla::XlaRuntimeExecutableProto* xla_runtime_executable) {
676
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
677
+ if (message_arena == nullptr) {
678
+ delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.xla_runtime_executable_);
679
+ }
680
+ if (xla_runtime_executable) {
681
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
682
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
683
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(xla_runtime_executable));
684
+ if (message_arena != submessage_arena) {
685
+ xla_runtime_executable = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
686
+ message_arena, xla_runtime_executable, submessage_arena);
687
+ }
688
+
689
+ } else {
690
+
691
+ }
692
+ _impl_.xla_runtime_executable_ = xla_runtime_executable;
693
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.xla_runtime_executable)
694
+ }
695
+
696
+ // .xla.EntryFunctionAttributes entry_func_attrs = 2;
697
+ inline bool XlaRuntimeGpuExecutableProto::_internal_has_entry_func_attrs() const {
698
+ return this != internal_default_instance() && _impl_.entry_func_attrs_ != nullptr;
699
+ }
700
+ inline bool XlaRuntimeGpuExecutableProto::has_entry_func_attrs() const {
701
+ return _internal_has_entry_func_attrs();
702
+ }
703
+ inline const ::xla::EntryFunctionAttributes& XlaRuntimeGpuExecutableProto::_internal_entry_func_attrs() const {
704
+ const ::xla::EntryFunctionAttributes* p = _impl_.entry_func_attrs_;
705
+ return p != nullptr ? *p : reinterpret_cast<const ::xla::EntryFunctionAttributes&>(
706
+ ::xla::_EntryFunctionAttributes_default_instance_);
707
+ }
708
+ inline const ::xla::EntryFunctionAttributes& XlaRuntimeGpuExecutableProto::entry_func_attrs() const {
709
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.entry_func_attrs)
710
+ return _internal_entry_func_attrs();
711
+ }
712
+ inline void XlaRuntimeGpuExecutableProto::unsafe_arena_set_allocated_entry_func_attrs(
713
+ ::xla::EntryFunctionAttributes* entry_func_attrs) {
714
+ if (GetArenaForAllocation() == nullptr) {
715
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.entry_func_attrs_);
716
+ }
717
+ _impl_.entry_func_attrs_ = entry_func_attrs;
718
+ if (entry_func_attrs) {
719
+
720
+ } else {
721
+
722
+ }
723
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.entry_func_attrs)
724
+ }
725
+ inline ::xla::EntryFunctionAttributes* XlaRuntimeGpuExecutableProto::release_entry_func_attrs() {
726
+
727
+ ::xla::EntryFunctionAttributes* temp = _impl_.entry_func_attrs_;
728
+ _impl_.entry_func_attrs_ = nullptr;
729
+ #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
730
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
731
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
732
+ if (GetArenaForAllocation() == nullptr) { delete old; }
733
+ #else // PROTOBUF_FORCE_COPY_IN_RELEASE
734
+ if (GetArenaForAllocation() != nullptr) {
735
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
736
+ }
737
+ #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
738
+ return temp;
739
+ }
740
+ inline ::xla::EntryFunctionAttributes* XlaRuntimeGpuExecutableProto::unsafe_arena_release_entry_func_attrs() {
741
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.entry_func_attrs)
742
+
743
+ ::xla::EntryFunctionAttributes* temp = _impl_.entry_func_attrs_;
744
+ _impl_.entry_func_attrs_ = nullptr;
745
+ return temp;
746
+ }
747
+ inline ::xla::EntryFunctionAttributes* XlaRuntimeGpuExecutableProto::_internal_mutable_entry_func_attrs() {
748
+
749
+ if (_impl_.entry_func_attrs_ == nullptr) {
750
+ auto* p = CreateMaybeMessage<::xla::EntryFunctionAttributes>(GetArenaForAllocation());
751
+ _impl_.entry_func_attrs_ = p;
752
+ }
753
+ return _impl_.entry_func_attrs_;
754
+ }
755
+ inline ::xla::EntryFunctionAttributes* XlaRuntimeGpuExecutableProto::mutable_entry_func_attrs() {
756
+ ::xla::EntryFunctionAttributes* _msg = _internal_mutable_entry_func_attrs();
757
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.entry_func_attrs)
758
+ return _msg;
759
+ }
760
+ inline void XlaRuntimeGpuExecutableProto::set_allocated_entry_func_attrs(::xla::EntryFunctionAttributes* entry_func_attrs) {
761
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
762
+ if (message_arena == nullptr) {
763
+ delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.entry_func_attrs_);
764
+ }
765
+ if (entry_func_attrs) {
766
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
767
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
768
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(entry_func_attrs));
769
+ if (message_arena != submessage_arena) {
770
+ entry_func_attrs = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
771
+ message_arena, entry_func_attrs, submessage_arena);
772
+ }
773
+
774
+ } else {
775
+
776
+ }
777
+ _impl_.entry_func_attrs_ = entry_func_attrs;
778
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.entry_func_attrs)
779
+ }
780
+
781
+ // string gpu_asm_text = 3;
782
+ inline void XlaRuntimeGpuExecutableProto::clear_gpu_asm_text() {
783
+ _impl_.gpu_asm_text_.ClearToEmpty();
784
+ }
785
+ inline const std::string& XlaRuntimeGpuExecutableProto::gpu_asm_text() const {
786
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_asm_text)
787
+ return _internal_gpu_asm_text();
788
+ }
789
+ template <typename ArgT0, typename... ArgT>
790
+ inline PROTOBUF_ALWAYS_INLINE
791
+ void XlaRuntimeGpuExecutableProto::set_gpu_asm_text(ArgT0&& arg0, ArgT... args) {
792
+
793
+ _impl_.gpu_asm_text_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
794
+ // @@protoc_insertion_point(field_set:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_asm_text)
795
+ }
796
+ inline std::string* XlaRuntimeGpuExecutableProto::mutable_gpu_asm_text() {
797
+ std::string* _s = _internal_mutable_gpu_asm_text();
798
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_asm_text)
799
+ return _s;
800
+ }
801
+ inline const std::string& XlaRuntimeGpuExecutableProto::_internal_gpu_asm_text() const {
802
+ return _impl_.gpu_asm_text_.Get();
803
+ }
804
+ inline void XlaRuntimeGpuExecutableProto::_internal_set_gpu_asm_text(const std::string& value) {
805
+
806
+ _impl_.gpu_asm_text_.Set(value, GetArenaForAllocation());
807
+ }
808
+ inline std::string* XlaRuntimeGpuExecutableProto::_internal_mutable_gpu_asm_text() {
809
+
810
+ return _impl_.gpu_asm_text_.Mutable(GetArenaForAllocation());
811
+ }
812
+ inline std::string* XlaRuntimeGpuExecutableProto::release_gpu_asm_text() {
813
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_asm_text)
814
+ return _impl_.gpu_asm_text_.Release();
815
+ }
816
+ inline void XlaRuntimeGpuExecutableProto::set_allocated_gpu_asm_text(std::string* gpu_asm_text) {
817
+ if (gpu_asm_text != nullptr) {
818
+
819
+ } else {
820
+
821
+ }
822
+ _impl_.gpu_asm_text_.SetAllocated(gpu_asm_text, GetArenaForAllocation());
823
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
824
+ if (_impl_.gpu_asm_text_.IsDefault()) {
825
+ _impl_.gpu_asm_text_.Set("", GetArenaForAllocation());
826
+ }
827
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
828
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_asm_text)
829
+ }
830
+
831
+ // bytes gpu_binary = 4;
832
+ inline void XlaRuntimeGpuExecutableProto::clear_gpu_binary() {
833
+ _impl_.gpu_binary_.ClearToEmpty();
834
+ }
835
+ inline const std::string& XlaRuntimeGpuExecutableProto::gpu_binary() const {
836
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_binary)
837
+ return _internal_gpu_binary();
838
+ }
839
+ template <typename ArgT0, typename... ArgT>
840
+ inline PROTOBUF_ALWAYS_INLINE
841
+ void XlaRuntimeGpuExecutableProto::set_gpu_binary(ArgT0&& arg0, ArgT... args) {
842
+
843
+ _impl_.gpu_binary_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
844
+ // @@protoc_insertion_point(field_set:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_binary)
845
+ }
846
+ inline std::string* XlaRuntimeGpuExecutableProto::mutable_gpu_binary() {
847
+ std::string* _s = _internal_mutable_gpu_binary();
848
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_binary)
849
+ return _s;
850
+ }
851
+ inline const std::string& XlaRuntimeGpuExecutableProto::_internal_gpu_binary() const {
852
+ return _impl_.gpu_binary_.Get();
853
+ }
854
+ inline void XlaRuntimeGpuExecutableProto::_internal_set_gpu_binary(const std::string& value) {
855
+
856
+ _impl_.gpu_binary_.Set(value, GetArenaForAllocation());
857
+ }
858
+ inline std::string* XlaRuntimeGpuExecutableProto::_internal_mutable_gpu_binary() {
859
+
860
+ return _impl_.gpu_binary_.Mutable(GetArenaForAllocation());
861
+ }
862
+ inline std::string* XlaRuntimeGpuExecutableProto::release_gpu_binary() {
863
+ // @@protoc_insertion_point(field_release:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_binary)
864
+ return _impl_.gpu_binary_.Release();
865
+ }
866
+ inline void XlaRuntimeGpuExecutableProto::set_allocated_gpu_binary(std::string* gpu_binary) {
867
+ if (gpu_binary != nullptr) {
868
+
869
+ } else {
870
+
871
+ }
872
+ _impl_.gpu_binary_.SetAllocated(gpu_binary, GetArenaForAllocation());
873
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
874
+ if (_impl_.gpu_binary_.IsDefault()) {
875
+ _impl_.gpu_binary_.Set("", GetArenaForAllocation());
876
+ }
877
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
878
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.XlaRuntimeGpuExecutableProto.gpu_binary)
879
+ }
880
+
881
+ // repeated .xla.gpu.XlaRuntimeGpuExecutableProto.ConstantInfoProto constants = 5;
882
+ inline int XlaRuntimeGpuExecutableProto::_internal_constants_size() const {
883
+ return _impl_.constants_.size();
884
+ }
885
+ inline int XlaRuntimeGpuExecutableProto::constants_size() const {
886
+ return _internal_constants_size();
887
+ }
888
+ inline void XlaRuntimeGpuExecutableProto::clear_constants() {
889
+ _impl_.constants_.Clear();
890
+ }
891
+ inline ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* XlaRuntimeGpuExecutableProto::mutable_constants(int index) {
892
+ // @@protoc_insertion_point(field_mutable:xla.gpu.XlaRuntimeGpuExecutableProto.constants)
893
+ return _impl_.constants_.Mutable(index);
894
+ }
895
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto >*
896
+ XlaRuntimeGpuExecutableProto::mutable_constants() {
897
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.XlaRuntimeGpuExecutableProto.constants)
898
+ return &_impl_.constants_;
899
+ }
900
+ inline const ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto& XlaRuntimeGpuExecutableProto::_internal_constants(int index) const {
901
+ return _impl_.constants_.Get(index);
902
+ }
903
+ inline const ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto& XlaRuntimeGpuExecutableProto::constants(int index) const {
904
+ // @@protoc_insertion_point(field_get:xla.gpu.XlaRuntimeGpuExecutableProto.constants)
905
+ return _internal_constants(index);
906
+ }
907
+ inline ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* XlaRuntimeGpuExecutableProto::_internal_add_constants() {
908
+ return _impl_.constants_.Add();
909
+ }
910
+ inline ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* XlaRuntimeGpuExecutableProto::add_constants() {
911
+ ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto* _add = _internal_add_constants();
912
+ // @@protoc_insertion_point(field_add:xla.gpu.XlaRuntimeGpuExecutableProto.constants)
913
+ return _add;
914
+ }
915
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::XlaRuntimeGpuExecutableProto_ConstantInfoProto >&
916
+ XlaRuntimeGpuExecutableProto::constants() const {
917
+ // @@protoc_insertion_point(field_list:xla.gpu.XlaRuntimeGpuExecutableProto.constants)
918
+ return _impl_.constants_;
919
+ }
920
+
921
+ #ifdef __GNUC__
922
+ #pragma GCC diagnostic pop
923
+ #endif // __GNUC__
924
+ // -------------------------------------------------------------------
925
+
926
+
927
+ // @@protoc_insertion_point(namespace_scope)
928
+
929
+ } // namespace gpu
930
+ } // namespace xla
931
+
932
+ // @@protoc_insertion_point(global_scope)
933
+
934
+ #include <google/protobuf/port_undef.inc>
935
+ #endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fexecutable_2eproto
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fft_thunk.h ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_FFT_THUNK_H_
17
+ #define XLA_SERVICE_GPU_FFT_THUNK_H_
18
+
19
+ #include <optional>
20
+
21
+ #include "absl/container/flat_hash_map.h"
22
+ #include "xla/hlo/ir/hlo_instruction.h"
23
+ #include "xla/service/buffer_assignment.h"
24
+ #include "xla/service/gpu/buffer_allocations.h"
25
+ #include "xla/service/gpu/thunk.h"
26
+ #include "xla/stream_executor/stream_executor.h"
27
+ #include "xla/types.h"
28
+ #include "xla/xla_data.pb.h"
29
+ #include "tsl/platform/status.h"
30
+
31
+ namespace xla {
32
+ namespace gpu {
33
+
34
+ struct FftPlan {
35
+ // CuFFT thread-safety requires that separate host threads not share plans;
36
+ // protect each plan with a mutex.
37
+ absl::Mutex mu;
38
+ std::unique_ptr<se::fft::Plan> plan ABSL_GUARDED_BY(mu);
39
+ float scale_factor ABSL_GUARDED_BY(mu);
40
+ };
41
+
42
+ class FftPlanCache {
43
+ public:
44
+ // Returnes Fft plan cached for the given device ordinal or creates a new one.
45
+ FftPlan* GetOrCreate(int device_ordinal) {
46
+ absl::MutexLock lock(&mu_);
47
+ std::unique_ptr<FftPlan>& plan = fft_plans_[device_ordinal];
48
+ if (!plan) plan = std::make_unique<FftPlan>();
49
+ return plan.get();
50
+ }
51
+
52
+ private:
53
+ absl::Mutex mu_;
54
+ absl::flat_hash_map<int, std::unique_ptr<FftPlan>> fft_plans_
55
+ ABSL_GUARDED_BY(mu_);
56
+ };
57
+
58
+ // This class stores everything that StreamExecutor needs to launch an FFT.
59
+ // It is generated by IrEmitter.
60
+ //
61
+ // This is thread-compatible.
62
+ class FftThunk : public Thunk {
63
+ public:
64
+ // Constructs a thunk for launching an FFT on a stream.
65
+ // Semantics of null hlo_instruction argument are as in Thunk.
66
+ FftThunk(ThunkInfo thunk_info, FftType fft_type,
67
+ absl::Span<const int64_t> fft_length,
68
+ const BufferAllocation::Slice& input_buffer,
69
+ const BufferAllocation::Slice& output_buffer,
70
+ const Shape& input_shape, const Shape& output_shape);
71
+
72
+ FftThunk(const FftThunk&) = delete; // Cannot share fft_plan_
73
+ FftThunk& operator=(const FftThunk&) = delete; // Cannot share fft_plan_
74
+
75
+ // Does the FFT for the thunk on "stream".
76
+ Status ExecuteOnStream(const ExecuteParams& params) override;
77
+
78
+ private:
79
+ const se::fft::Type fft_type_;
80
+ const std::vector<int64_t> fft_length_;
81
+
82
+ FftPlanCache fft_plan_cache_;
83
+
84
+ const BufferAllocation::Slice input_buffer_;
85
+ const BufferAllocation::Slice output_buffer_;
86
+
87
+ const Shape input_shape_;
88
+ const Shape output_shape_;
89
+ };
90
+
91
+ Status RunFft(se::DeviceMemoryBase input, const Shape& input_shape,
92
+ se::DeviceMemoryBase output, const Shape& output_shape,
93
+ se::fft::Type fft_type, absl::Span<const int64_t> fft_length,
94
+ int device_ordinal, FftPlanCache* fft_plan_cache,
95
+ se::Stream* stream, se::DeviceMemoryAllocator* memory_allocator);
96
+
97
+ } // namespace gpu
98
+ } // namespace xla
99
+
100
+ #endif // XLA_SERVICE_GPU_FFT_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/for_thunk.h ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_FOR_THUNK_H_
17
+ #define XLA_SERVICE_GPU_FOR_THUNK_H_
18
+
19
+ #include <vector>
20
+
21
+ #include "xla/hlo/ir/hlo_instruction.h"
22
+ #include "xla/service/gpu/buffer_allocations.h"
23
+ #include "xla/service/gpu/sequential_thunk.h"
24
+ #include "xla/service/gpu/thunk.h"
25
+ #include "xla/stream_executor/stream_executor.h"
26
+
27
+ namespace xla {
28
+ namespace gpu {
29
+
30
+ // ForThunk executes 'loop_limit' invocations of 'body_thunk_sequence'.
31
+ class ForThunk : public Thunk {
32
+ public:
33
+ ForThunk(ThunkInfo thunk_info, int64_t loop_limit,
34
+ std::unique_ptr<ThunkSequence> body_thunk_sequence);
35
+ ForThunk(const ForThunk&) = delete;
36
+ ForThunk& operator=(const ForThunk&) = delete;
37
+
38
+ Status Initialize(const GpuExecutable& executable,
39
+ se::StreamExecutor* executor) override;
40
+ Status ExecuteOnStream(const ExecuteParams& params) override;
41
+
42
+ SequentialThunk* body_thunk_sequence() { return body_thunk_sequence_.get(); }
43
+
44
+ private:
45
+ const int64_t loop_limit_;
46
+ std::unique_ptr<SequentialThunk> body_thunk_sequence_;
47
+ };
48
+
49
+ } // namespace gpu
50
+ } // namespace xla
51
+
52
+ #endif // XLA_SERVICE_GPU_FOR_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fused_mha_thunk.h ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_FUSED_MHA_THUNK_H_
17
+ #define XLA_SERVICE_GPU_FUSED_MHA_THUNK_H_
18
+
19
+ #include <memory>
20
+ #include <optional>
21
+
22
+ #include "absl/container/flat_hash_map.h"
23
+ #include "xla/hlo/ir/hlo_instruction.h"
24
+ #include "xla/hlo/ir/hlo_instructions.h"
25
+ #include "xla/service/buffer_assignment.h"
26
+ #include "xla/service/gpu/buffer_allocations.h"
27
+ #include "xla/service/gpu/gpu_executable.h"
28
+ #include "xla/service/gpu/gpu_fused_mha_runner.h"
29
+ #include "xla/service/gpu/thunk.h"
30
+ #include "xla/stream_executor/stream_executor.h"
31
+ #include "xla/types.h"
32
+ #include "xla/xla_data.pb.h"
33
+ #include "tsl/platform/status.h"
34
+
35
+ namespace xla {
36
+ namespace gpu {
37
+
38
+ // This class stores everything that StreamExecutor needs to launch a DNN
39
+ // fMHA. It is generated by IrEmitter.
40
+ //
41
+ // This is thread-compatible.
42
+ class FusedMHAThunk : public Thunk {
43
+ public:
44
+ // Constructs a thunk for launching a DNN FMHA.
45
+ FusedMHAThunk(ThunkInfo thunk_info, GpufMHAConfig config,
46
+ BufferAllocation::Slice lhs_bmm1_slice,
47
+ BufferAllocation::Slice rhs_bmm1_slice,
48
+ BufferAllocation::Slice rhs_bmm2_slice,
49
+ BufferAllocation::Slice output_slice,
50
+ BufferAllocation::Slice scratch_slice,
51
+ BufferAllocation::Slice mask_slice, /* may be null */
52
+ BufferAllocation::Slice bias_slice /* may be null */,
53
+ BufferAllocation::Slice activation_slice /* may be null */);
54
+
55
+ FusedMHAThunk(const FusedMHAThunk&) = delete;
56
+ FusedMHAThunk& operator=(const FusedMHAThunk&) = delete;
57
+
58
+ Status ExecuteOnStream(const ExecuteParams& params) override;
59
+
60
+ private:
61
+ BufferAllocation::Slice lhs_bmm1_buffer_;
62
+ BufferAllocation::Slice rhs_bmm1_buffer_;
63
+ BufferAllocation::Slice rhs_bmm2_buffer_;
64
+ BufferAllocation::Slice output_buffer_;
65
+ BufferAllocation::Slice scratch_buffer_;
66
+ BufferAllocation::Slice mask_buffer_;
67
+ BufferAllocation::Slice bias_buffer_;
68
+ BufferAllocation::Slice activation_buffer_;
69
+
70
+ FusedMultiHeadedAttentionRunner& GetOrCreateRunner(
71
+ const stream_executor::Stream* stream);
72
+
73
+ // FusedMHA config
74
+ const GpufMHAConfig config_;
75
+ absl::Mutex mu_;
76
+ absl::flat_hash_map<const stream_executor::Stream*,
77
+ std::unique_ptr<FusedMultiHeadedAttentionRunner>>
78
+ runner_cache_ ABSL_GUARDED_BY(mu_);
79
+ };
80
+
81
+ class FusedMHABackwardThunk : public Thunk {
82
+ public:
83
+ // Constructs a thunk for launching a DNN FMHA backward.
84
+ FusedMHABackwardThunk(ThunkInfo thunk_info, GpufMHABackwardConfig config,
85
+ BufferAllocation::Slice bmm1_grad_gemm1_rhs_slice,
86
+ BufferAllocation::Slice bmm1_grad_gemm2_rhs_slice,
87
+ BufferAllocation::Slice bmm2_grad_gemm1_lhs_slice,
88
+ BufferAllocation::Slice bmm2_grad_gemm2_rhs_slice,
89
+ BufferAllocation::Slice d_output_slice,
90
+ BufferAllocation::Slice scratch_slice,
91
+ BufferAllocation::Slice d_bmm1_lhs_slice,
92
+ BufferAllocation::Slice d_bmm1_rhs_slice,
93
+ BufferAllocation::Slice d_bmm2_rhs_slice,
94
+ BufferAllocation::Slice d_S_slice,
95
+ BufferAllocation::Slice mask_slice,
96
+ BufferAllocation::Slice d_bias_slice);
97
+
98
+ FusedMHABackwardThunk(const FusedMHABackwardThunk&) = delete;
99
+ FusedMHABackwardThunk& operator=(const FusedMHABackwardThunk&) = delete;
100
+
101
+ Status ExecuteOnStream(const ExecuteParams& params) override;
102
+
103
+ private:
104
+ BufferAllocation::Slice bmm1_grad_gemm1_rhs_buffer_;
105
+ BufferAllocation::Slice bmm1_grad_gemm2_rhs_buffer_;
106
+ BufferAllocation::Slice bmm2_grad_gemm1_lhs_buffer_;
107
+ BufferAllocation::Slice bmm2_grad_gemm2_rhs_buffer_;
108
+ BufferAllocation::Slice d_output_buffer_;
109
+ BufferAllocation::Slice scratch_buffer_;
110
+ BufferAllocation::Slice d_bmm1_lhs_buffer_;
111
+ BufferAllocation::Slice d_bmm1_rhs_buffer_;
112
+ BufferAllocation::Slice d_bmm2_rhs_buffer_;
113
+ BufferAllocation::Slice d_s_buffer_;
114
+ BufferAllocation::Slice mask_buffer_;
115
+ BufferAllocation::Slice d_bias_buffer_;
116
+
117
+ FusedMultiHeadedAttentionBackwardRunner& GetOrCreateRunner(
118
+ const stream_executor::Stream* stream);
119
+
120
+ // FusedMHA backward config
121
+ const GpufMHABackwardConfig config_;
122
+ absl::Mutex mu_;
123
+ absl::flat_hash_map<const stream_executor::Stream*,
124
+ std::unique_ptr<FusedMultiHeadedAttentionBackwardRunner>>
125
+ runner_cache_ ABSL_GUARDED_BY(mu_);
126
+ };
127
+ } // namespace gpu
128
+ } // namespace xla
129
+ #endif // XLA_SERVICE_GPU_FUSED_MHA_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_merger.h ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_FUSION_MERGER_H_
17
+ #define XLA_SERVICE_GPU_FUSION_MERGER_H_
18
+
19
+ #include "xla/hlo/ir/hlo_module.h"
20
+ #include "xla/service/gpu/gpu_hlo_cost_analysis.h"
21
+ #include "xla/service/hlo_pass_interface.h"
22
+ #include "xla/stream_executor/device_description.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // An HLO pass that attempts to merge fusion instructions to reduce memory
28
+ // bandwidth requirements and kernel launch overhead.
29
+ //
30
+ // Consider the example below. On the left-hand side, op A is the producer and
31
+ // ops B and C are its consumers. FusionMerger duplicates producer ops and fuses
32
+ // them into all consumers. The result is depicted on the right-hand side below.
33
+ //
34
+ // p p
35
+ // | / \
36
+ // v / \
37
+ // A +fusion+ +fusion+
38
+ // / \ | A' | | A" |
39
+ // | | | | | | | |
40
+ // v v | v | | v |
41
+ // B C | B | | C |
42
+ // +------+ +------+
43
+ //
44
+ // Op A has been cloned twice and fused with B and C. The kernel launch overhead
45
+ // is reduced from 3 to 2. The memory bandwidth requirements may be reduced.
46
+ // We trade 1 read of input(A) + 1 write and 2 reads of output(A) for 2 reads of
47
+ // input(A). In general the achieveable savings in memory bandwidth depend on
48
+ // the differences in memory read and written and the number of consumers. The
49
+ // FusionMeger pass takes this into account when making fusion decisions.
50
+ //
51
+ // The pass traverses the HLO module in reverse post-order (defs before uses).
52
+ // Fusion instructions are merged into their users if some conditions are met:
53
+ // * The result of merging the fusion instruction into its users would not
54
+ // increase bytes transferred.
55
+ // * Producer ops are fusible with _all_ consumers. If they are not fusible with
56
+ // at least one consumers, they won't be fused at all.
57
+ // * Producers are kLoop fusion ops.
58
+ //
59
+ // None of these restrictions are necessary for correctness. In fact, lifting
60
+ // the latter two could be beneficial.
61
+
62
+ class FusionMerger : public HloModulePass {
63
+ public:
64
+ explicit FusionMerger(const se::DeviceDescription& d,
65
+ HloCostAnalysis::ShapeSizeFunction f)
66
+ : gpu_device_info_(d), shape_size_function_(f) {}
67
+ absl::string_view name() const override { return "fusion_merger"; }
68
+
69
+ using HloPassInterface::Run;
70
+ StatusOr<bool> Run(
71
+ HloModule* module,
72
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
73
+
74
+ private:
75
+ se::DeviceDescription gpu_device_info_;
76
+ HloCostAnalysis::ShapeSizeFunction shape_size_function_;
77
+ };
78
+
79
+ } // namespace gpu
80
+ } // namespace xla
81
+
82
+ #endif // XLA_SERVICE_GPU_FUSION_MERGER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_pipeline.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_FUSION_PIPELINE_H_
17
+ #define XLA_SERVICE_GPU_FUSION_PIPELINE_H_
18
+
19
+ #include "xla/service/hlo_cost_analysis.h"
20
+ #include "xla/service/hlo_pass_pipeline.h"
21
+ #include "xla/stream_executor/device_description.h"
22
+ #include "xla/xla.pb.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // Function wrapper around the (non-horizontal) XLA GPU fusion pipeline.
28
+ HloPassPipeline FusionPipeline(
29
+ const DebugOptions& debug_options,
30
+ HloCostAnalysis::ShapeSizeFunction shape_size_bytes_function,
31
+ const se::DeviceDescription& gpu_device_info);
32
+
33
+ // Function wrapper around the horizontal XLA GPU fusion pipeline.
34
+ HloPassPipeline HorizontalFusionPipeline(
35
+ const se::DeviceDescription& gpu_device_info);
36
+
37
+ } // namespace gpu
38
+ } // namespace xla
39
+
40
+ #endif // XLA_SERVICE_GPU_FUSION_PIPELINE_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusion_wrapper.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSION_WRAPPER_H_
16
+ #define XLA_SERVICE_GPU_FUSION_WRAPPER_H_
17
+
18
+ #include "absl/container/flat_hash_set.h"
19
+ #include "absl/strings/string_view.h"
20
+ #include "xla/hlo/ir/hlo_module.h"
21
+ #include "xla/service/hlo_pass_interface.h"
22
+ #include "xla/statusor.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // Wraps leftover unfused instruction that are in the entry computation that
28
+ // have no LHLO equivalent in fusions containing just that instruction.
29
+ class FusionWrapper : public HloModulePass {
30
+ public:
31
+ absl::string_view name() const override { return "fusion-wrapper"; }
32
+
33
+ using HloPassInterface::Run;
34
+ StatusOr<bool> Run(
35
+ HloModule* module,
36
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
37
+ };
38
+
39
+ } // namespace gpu
40
+ } // namespace xla
41
+
42
+ #endif // XLA_SERVICE_GPU_FUSION_WRAPPER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/copy.h ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_COPY_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_COPY_H_
17
+
18
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
19
+ #include "xla/service/gpu/ir_emitter_context.h"
20
+
21
+ namespace xla {
22
+ namespace gpu {
23
+
24
+ // Special case of a fusion consisting only of a kCopy instruction that can be
25
+ // implemented using a memcpy.
26
+ class MemcpyFusion : public FusionInterface {
27
+ public:
28
+ MemcpyFusion(mlir::Value src, mlir::Value dst) : src_(src), dst_(dst) {}
29
+
30
+ StatusOr<FusionEmissionResult> Emit(IrEmitterContext& ir_emitter_context,
31
+ ElementalIrEmitter& elemental_emitter,
32
+ mlir::lmhlo::FusionOp fusion_op,
33
+ const HloFusionInstruction& fusion,
34
+ KernelReuseCache& kernel_cache,
35
+ llvm::IRBuilder<>*) const final;
36
+
37
+ private:
38
+ mlir::Value src_;
39
+ mlir::Value dst_;
40
+ };
41
+
42
+ } // namespace gpu
43
+ } // namespace xla
44
+
45
+ #endif // XLA_SERVICE_GPU_FUSIONS_COPY_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/fusion_emitter.h ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_FUSION_EMITTER_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_FUSION_EMITTER_H_
17
+
18
+ #include <memory>
19
+ #include <optional>
20
+ #include <vector>
21
+
22
+ #include "xla/hlo/ir/hlo_instructions.h"
23
+ #include "xla/mlir_hlo/lhlo/IR/lhlo_ops.h"
24
+ #include "xla/service/elemental_ir_emitter.h"
25
+ #include "xla/service/gpu/ir_emitter_context.h"
26
+ #include "xla/service/gpu/kernel_reuse_cache.h"
27
+ #include "xla/service/gpu/launch_dimensions.h"
28
+ #include "xla/service/gpu/thunk.h"
29
+ #include "xla/service/llvm_ir/ir_array.h"
30
+
31
+ namespace xla {
32
+ namespace gpu {
33
+
34
+ struct FusionEmissionResult {
35
+ std::vector<std::unique_ptr<Thunk>> thunks;
36
+ };
37
+
38
+ class FusionInterface {
39
+ public:
40
+ virtual ~FusionInterface() = default;
41
+
42
+ virtual StatusOr<FusionEmissionResult> Emit(
43
+ IrEmitterContext& ir_emitter_context,
44
+ ElementalIrEmitter& elemental_emitter, mlir::lmhlo::FusionOp fusion_op,
45
+ const HloFusionInstruction& fusion, KernelReuseCache& kernel_cache,
46
+ llvm::IRBuilder<>* builder) const = 0;
47
+ };
48
+
49
+ class KernelFusionEmitterBase : public FusionInterface {
50
+ public:
51
+ // The downstream code that is used by this emitter operates on a mix of MLIR
52
+ // and HLO classes. Ideally this would not be the case, but it's hard to
53
+ // change.
54
+ StatusOr<FusionEmissionResult> Emit(IrEmitterContext& ir_emitter_context,
55
+ ElementalIrEmitter& elemental_emitter,
56
+ mlir::lmhlo::FusionOp fusion_op,
57
+ const HloFusionInstruction& fusion,
58
+ KernelReuseCache& kernel_cache,
59
+ llvm::IRBuilder<>* builder) const final;
60
+ virtual StatusOr<LaunchDimensions> launch_dimensions(
61
+ IrEmitterContext& ir_emitter_context, int kernel_index) const = 0;
62
+
63
+ protected:
64
+ virtual Status EmitKernel(IrEmitterContext& ir_emitter_context,
65
+ ElementalIrEmitter& elemental_emitter,
66
+ mlir::lmhlo::FusionOp fusion_op,
67
+ const HloFusionInstruction& fusion,
68
+ const LaunchDimensions& launch_dims,
69
+ std::vector<llvm_ir::IrArray> inputs,
70
+ std::vector<llvm_ir::IrArray> outputs,
71
+ llvm::IRBuilder<>* builder,
72
+ int kernel_index) const = 0;
73
+ virtual int num_kernels() const { return 1; }
74
+ };
75
+
76
+ std::tuple<llvm::Function*, std::vector<llvm_ir::IrArray /*inputs*/>,
77
+ std::vector<llvm_ir::IrArray> /*outputs*/>
78
+ BuildKernelPrototype(IrEmitterContext& ir_emitter_context,
79
+ const std::string& suggested_name,
80
+ absl::Span<const KernelArgument> arguments,
81
+ size_t num_inputs,
82
+ const LaunchDimensions& launch_dimensions,
83
+ llvm::IRBuilder<>* builder);
84
+
85
+ } // namespace gpu
86
+ } // namespace xla
87
+
88
+ #endif // XLA_SERVICE_GPU_FUSIONS_FUSION_EMITTER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/fusions.h ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_FUSIONS_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_FUSIONS_H_
17
+
18
+ #include <memory>
19
+ #include <optional>
20
+
21
+ #include "absl/types/span.h"
22
+ #include "xla/mlir_hlo/lhlo/IR/lhlo_ops.h"
23
+ #include "xla/service/buffer_assignment.h"
24
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
25
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
26
+
27
+ namespace xla {
28
+ namespace gpu {
29
+
30
+ // Returns the emitter for the given fusion. Returns nullopt if the fusion
31
+ // type is not yet supported.
32
+ // `allocations` may be empty and `fusion_op` may be nullptr if buffer
33
+ // assignment didn't run yet.
34
+ std::optional<std::unique_ptr<FusionInterface>> GetFusionEmitter(
35
+ HloFusionAnalysis& analysis, absl::Span<const BufferAllocation> allocations,
36
+ mlir::lmhlo::FusionOp fusion_op);
37
+
38
+ } // namespace gpu
39
+ } // namespace xla
40
+
41
+ #endif // XLA_SERVICE_GPU_FUSIONS_FUSIONS_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/in_place_dynamic_update_slice.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_IN_PLACE_DYNAMIC_UPDATE_SLICE_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_IN_PLACE_DYNAMIC_UPDATE_SLICE_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
21
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
22
+ #include "xla/service/gpu/ir_emission_utils.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // Fusion node where the root is either:
28
+ // 1. a dynamic-update-slice op
29
+ // 2. a bitcast of a dynamic-update-slice op
30
+ // 3. a tuple op returning the result of several dynamic-update-slice ops
31
+ // 4. a tuple op returning the result of several bitcast
32
+ // dynamic-update-slice ops
33
+ //
34
+ // Additionally, all the dynamic-update-slice ops have exactly one user. The
35
+ // fusion parameter that they update can have users (in addition to the
36
+ // dynamic-update-slice op) that read in either
37
+ // a. a dynamic-slice corresponding exactly to the slice of the parameter that
38
+ // is updated by the dynamic-update-slice op
39
+ // b. a dynamic-slice reading in a single element anywhere in the parameter.
40
+ // This is only allowed if the dynamic-update-slice op updates a single
41
+ // element
42
+ //
43
+ // In both cases, the additional users must not flow into any other output
44
+ // than the dynamic-slice-update corresponding to that particular slice of the
45
+ // parameter.
46
+ //
47
+ // The assumption is that each op's input (i.e. array to update) shares the
48
+ // same slice as its output. In this case, we have a special algorithm that
49
+ // modifies the output in place without touching the un-updated elements. The
50
+ // update slice is assumed to be the exact same for all the
51
+ // dynamic-update-slice ops.
52
+ class InPlaceDynamicUpdateSliceEmitter : public KernelFusionEmitterBase {
53
+ public:
54
+ explicit InPlaceDynamicUpdateSliceEmitter(const HloFusionAnalysis& analysis)
55
+ : dus_ops_(
56
+ GetOutputDefiningDynamicUpdateSlices(analysis.fusion_roots())) {}
57
+ StatusOr<LaunchDimensions> launch_dimensions(
58
+ IrEmitterContext& ir_emitter_context, int kernel_index) const override;
59
+
60
+ protected:
61
+ Status EmitKernel(IrEmitterContext& ir_emitter_context,
62
+ ElementalIrEmitter& elemental_emitter,
63
+ mlir::lmhlo::FusionOp fusion_op,
64
+ const HloFusionInstruction& fusion,
65
+ const LaunchDimensions& launch_dims,
66
+ std::vector<llvm_ir::IrArray> inputs,
67
+ std::vector<llvm_ir::IrArray> outputs,
68
+ llvm::IRBuilder<>* builder,
69
+ int kernel_index) const override;
70
+
71
+ std::vector<const HloInstruction*> dus_ops_;
72
+ };
73
+
74
+ } // namespace gpu
75
+ } // namespace xla
76
+
77
+ #endif // XLA_SERVICE_GPU_FUSIONS_IN_PLACE_DYNAMIC_UPDATE_SLICE_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/input_slices.h ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_INPUT_SLICES_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_INPUT_SLICES_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
21
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
22
+
23
+ namespace xla {
24
+ namespace gpu {
25
+
26
+ // Generates code for input-fusible slices.
27
+ //
28
+ // Prerequisite: ROOT is either a slice or a tuple of slices. The input shapes
29
+ // of all ROOT slices need to be the same while their output shapes can be
30
+ // different. On the other hand, the input ranges of slices can be
31
+ // overlapping. Further generalization/specialization when the needs are seen
32
+ // in the future.
33
+ class InputSlicesFusion : public KernelFusionEmitterBase {
34
+ public:
35
+ explicit InputSlicesFusion(HloFusionAnalysis& analysis)
36
+ : analysis_(analysis) {}
37
+ StatusOr<LaunchDimensions> launch_dimensions(
38
+ IrEmitterContext& ir_emitter_context, int kernel_index) const override;
39
+
40
+ protected:
41
+ Status EmitKernel(IrEmitterContext& ir_emitter_context,
42
+ ElementalIrEmitter& elemental_emitter,
43
+ mlir::lmhlo::FusionOp fusion_op,
44
+ const HloFusionInstruction& fusion,
45
+ const LaunchDimensions& launch_dims,
46
+ std::vector<llvm_ir::IrArray> inputs,
47
+ std::vector<llvm_ir::IrArray> outputs,
48
+ llvm::IRBuilder<>* builder,
49
+ int kernel_index) const override;
50
+
51
+ private:
52
+ HloFusionAnalysis& analysis_;
53
+ };
54
+
55
+ } // namespace gpu
56
+ } // namespace xla
57
+
58
+ #endif // XLA_SERVICE_GPU_FUSIONS_INPUT_SLICES_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/loop.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_LOOP_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_LOOP_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "xla/hlo/ir/hlo_instructions.h"
21
+ #include "xla/mlir_hlo/lhlo/IR/lhlo_ops.h"
22
+ #include "xla/service/elemental_ir_emitter.h"
23
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
24
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
25
+ #include "xla/service/gpu/ir_emitter_context.h"
26
+
27
+ namespace xla {
28
+ namespace gpu {
29
+
30
+ // Generic loop fusion.
31
+ class LoopFusion : public KernelFusionEmitterBase {
32
+ public:
33
+ explicit LoopFusion(HloFusionAnalysis& analysis) : analysis_(analysis) {}
34
+ StatusOr<LaunchDimensions> launch_dimensions(
35
+ IrEmitterContext& ir_emitter_context, int kernel_index) const override;
36
+
37
+ protected:
38
+ Status EmitKernel(IrEmitterContext& ir_emitter_context,
39
+ ElementalIrEmitter& elemental_emitter,
40
+ mlir::lmhlo::FusionOp fusion_op,
41
+ const HloFusionInstruction& fusion,
42
+ const LaunchDimensions& launch_dims,
43
+ std::vector<llvm_ir::IrArray> inputs,
44
+ std::vector<llvm_ir::IrArray> outputs,
45
+ llvm::IRBuilder<>* builder,
46
+ int kernel_index) const override;
47
+
48
+ private:
49
+ HloFusionAnalysis& analysis_;
50
+ };
51
+
52
+ } // namespace gpu
53
+ } // namespace xla
54
+
55
+ #endif // XLA_SERVICE_GPU_FUSIONS_LOOP_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/reduction.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_REDUCTION_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_REDUCTION_H_
17
+
18
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
19
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
20
+
21
+ namespace xla {
22
+ namespace gpu {
23
+
24
+ // Generates code for reduction to contiguous dimensions.
25
+ //
26
+ // Row reduction uses the following algorithm described in CUDA-like
27
+ // pseudocode:
28
+ //
29
+ // ```
30
+ // __global__ void reduce(int num_rows, float *in, float out) {
31
+ // __shared__ float[32] cache;
32
+ // int offset = blockDim.x * blockIdx.x + threadIdx.x;
33
+ // if (offset >= num_rows) return;
34
+ // int tile_bound = std::min(offset + kTileSizeX, num_rows);
35
+ // float accum = 0;
36
+ // for (int i=offset; i<num_rows; i+= blockDim.x) {
37
+ // accum += in[i];
38
+ // }
39
+ // accum = warp_reduce(accum);
40
+ // if (threadIdx.x % WarpSize == 0) {
41
+ // cache[threadIdx.x / WarpSize] = accum;
42
+ // }
43
+ // __syncthreads();
44
+ // if (threadIdx.x / WarpSize == 0) {
45
+ // bool warp_exists = threadIdx.x < (blockDim.x / WarpSize);
46
+ // float block_accum = warp_exists ? cache[threadIdx.x % WarpSize] : 0;
47
+ // block_accum = warp_reduce(accum);
48
+ // if (threadIdx.x == 0) {
49
+ // out += block_accum;
50
+ // }
51
+ // }
52
+ // }
53
+ // ```
54
+ //
55
+ // Column reduction uses the following algorithm:
56
+ //
57
+ // ```
58
+ // void reduce(float** in, float* out) {
59
+ // __shared__ float[32][33] cache;
60
+ // int thread_id = GetThreadId();
61
+ // int block_id = GetBlockId();
62
+ // int tile_size = 128;
63
+ //
64
+ // float accum = 0;
65
+ // for (int i=0; i<tile_size; i++) {
66
+ // accum += in[thread_id.y * tile_size + i][block_id * 32 + thread_id.x];
67
+ // }
68
+ // cache[thread_id.x][thread_id.y] = accum;
69
+ //
70
+ // __syncthreads();
71
+ // accum = cache[thread_id.y][thread_id.x];
72
+ // accum = warp_reduce(accum); // Sum all the values of `accum` in the same
73
+ // // warp.
74
+ //
75
+ // if (thread_id.y % 32 == 0) {
76
+ // out[block_id * 32 + thread_id.x] = accum;
77
+ // }
78
+ // }
79
+ // ```
80
+ //
81
+ // Moreover, a heuristic is implemented to divide the reduce instructions
82
+ // into groups for parallelization (see `DivideOutputInstructionsIntoGroups`
83
+ // for details about the heuristic.) Reduce instructions in the same group
84
+ // will run sequentially while different groups will run in parallel.
85
+ //
86
+ // we use raw block_id_y to select the reduce groups for execution without
87
+ // complicating the index calculation in the code generation of the reduce
88
+ // instructions. In other words, a block_id_y is assigned to a group and so
89
+ // different groups can be run in parallel.
90
+ class ReductionFusion : public FusionInterface {
91
+ public:
92
+ explicit ReductionFusion(HloFusionAnalysis& analysis) : analysis_(analysis) {}
93
+
94
+ StatusOr<FusionEmissionResult> Emit(
95
+ IrEmitterContext& ir_emitter_context,
96
+ ElementalIrEmitter& elemental_emitter, mlir::lmhlo::FusionOp fusion_op,
97
+ const HloFusionInstruction& fusion, KernelReuseCache& kernel_cache,
98
+ llvm::IRBuilder<>* builder) const override;
99
+
100
+ private:
101
+ HloFusionAnalysis& analysis_;
102
+ };
103
+
104
+ } // namespace gpu
105
+ } // namespace xla
106
+
107
+ #endif // XLA_SERVICE_GPU_FUSIONS_REDUCTION_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/thunk_util.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_THUNK_UTIL_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_THUNK_UTIL_H_
17
+
18
+ #include <memory>
19
+ #include <optional>
20
+
21
+ #include "xla/service/gpu/ir_emitter_context.h"
22
+ #include "xla/service/gpu/thunk.h"
23
+ #include "xla/statusor.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ // Attempts to build an initializer constant for the given value. Returns an
29
+ // empty optional if the value is not a constant.
30
+ StatusOr<std::optional<std::unique_ptr<Thunk>>> BuildConstantInitializerThunk(
31
+ IrEmitterContext& ir_emitter_context, mlir::Operation* op,
32
+ mlir::Value init_value, mlir::Value dest);
33
+
34
+ } // namespace gpu
35
+ } // namespace xla
36
+
37
+ #endif // XLA_SERVICE_GPU_FUSIONS_THUNK_UTIL_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/tiling_util.h ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_TILING_UTIL_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_TILING_UTIL_H_
17
+
18
+ #include <functional>
19
+
20
+ #include "xla/service/gpu/kernel_mapping_scheme.h"
21
+ #include "xla/service/llvm_ir/ir_array.h"
22
+
23
+ namespace xla {
24
+ namespace gpu {
25
+
26
+ // Contains threading information. Note that for performance we might apply
27
+ // thread id "scaling" where the physical thread id (to achieve good SM
28
+ // occupancy) will differ from logical thread id. This struct contains
29
+ // logical thread ids, along with meta-information about the scaling applied.
30
+ struct TilingThreadIdInfo {
31
+ TilingThreadIdInfo(llvm::Value* thread_id, llvm::Value* thread_id_x,
32
+ llvm::Value* thread_id_y, llvm::Value* lane_id,
33
+ llvm::Value* block_id, llvm::Value* scaling)
34
+ : thread_id(thread_id),
35
+ thread_id_x(thread_id_x),
36
+ thread_id_y(thread_id_y),
37
+ lane_id(lane_id),
38
+ block_id(block_id),
39
+ scaling(scaling) {}
40
+
41
+ llvm::Value* thread_id;
42
+
43
+ // X-coordinate calculated from thread id: `thread_id % num_threads_x`
44
+ llvm::Value* thread_id_x;
45
+
46
+ // Y-coordinate calculated from thread id: `thread_id / num_threads_x`
47
+ llvm::Value* thread_id_y;
48
+
49
+ // Lane id: `thread_id % WarpSize`
50
+ llvm::Value* lane_id;
51
+
52
+ // Block id.
53
+ llvm::Value* block_id;
54
+
55
+ // Emits GEP into a shared memory, taking virtual thread scaling into
56
+ // account. Automatically inserts the first zero required by LLVM GEP.
57
+ // Defined on ThreadIdInfo to keep `scaling` private.
58
+ //
59
+ // Same semantics as CreateInBoundsGEP.
60
+ llvm::Value* GEPIntoSharedMemory(
61
+ llvm::IRBuilder<>* b, llvm::GlobalVariable* shared,
62
+ absl::Span<llvm::Value* const> idx_major_to_minor,
63
+ const llvm::Twine& name = "") const;
64
+
65
+ // Calculate the pointee type of the llvm::Value returned by
66
+ // GEPIntoSharedMemory
67
+ llvm::Type* GEPIntoSharedMemoryType(
68
+ llvm::GlobalVariable* shared,
69
+ absl::Span<llvm::Value* const> idx_major_to_minor) const;
70
+
71
+ private:
72
+ llvm::Value* scaling;
73
+ };
74
+
75
+ struct TilingKernelInfo {
76
+ // Tiling bounds.
77
+ std::array<llvm::Value*, 2> output_tile_bounds;
78
+
79
+ // Starting tile, as calculated from block id only.
80
+ llvm_ir::IrArray::Index tile_origin;
81
+
82
+ // Thread meta-info.
83
+ TilingThreadIdInfo thread_id_info;
84
+ };
85
+
86
+ // A function to generate the code to emit the entire tile.
87
+ //
88
+ // index: Absolute coordinate of the start of the tile in input.
89
+ // tile_dimensions: Size of the tile
90
+ using TileElementGenerator =
91
+ std::function<void(const TilingThreadIdInfo& thread_id_info,
92
+ const llvm_ir::IrArray::Index& index,
93
+ std::array<llvm::Value*, 2> tile_dimensions)>;
94
+
95
+ // A function object to generate code to process one element in a tile.
96
+ //
97
+ // index: the index for the first output element of the current thread.
98
+ // y_loc: The y coordinate within a tile.
99
+ // x_loc: The x coordinate within a tile.
100
+ using EmitTileElementFunction =
101
+ std::function<void(const TilingThreadIdInfo& thread_id_info,
102
+ const llvm_ir::IrArray::Index& index, llvm::Value* y_loc,
103
+ llvm::Value* x_loc)>;
104
+
105
+ // Emits code to iterate through a 2-dimensional tile with a given tile
106
+ // dimensions and given strides, and call the callback at each iteration.,
107
+ //
108
+ // thread_id_y` and `thread_id_x` are the intra-tile coordinates for
109
+ // the first element to process, and `index` is the index for the origin of
110
+ // the tile. Emits bounds check to ensure that each processed element
111
+ // is within the boundary defined by `tile_dimensions`.
112
+ //
113
+ // Rough pseudocode:
114
+ //
115
+ // Given: tile_dimensions, x_offset, y_offset
116
+ //
117
+ // for (y = 0; y < tile_dimensions[0]; y += num_threads_y) {
118
+ // for (x = 0; x < tile_dimensions[1]; x++) {
119
+ //
120
+ // y_pos = y_offset + y
121
+ // x_pos = x_offset + x * stride
122
+ //
123
+ // if (x_loc < tile_width) {
124
+ // emit_elem_function(y_offset + y, x_loc);
125
+ // }
126
+ // }
127
+ // }
128
+ //
129
+ void EmitTile(llvm::IRBuilder<>* builder, const TilingScheme& tiling_scheme,
130
+ const llvm_ir::IrArray::Index& tile_origin_index,
131
+ const TilingThreadIdInfo& thread_id_info,
132
+ std::array<llvm::Value*, 2> tile_dimensions,
133
+ const EmitTileElementFunction& emit_elem_function);
134
+
135
+ // Emits a kernel for the hlo instruction using the given kernel mapping
136
+ // scheme.
137
+ StatusOr<TilingKernelInfo> EmitTilingKernel(
138
+ llvm::IRBuilder<>* builder, const TilingScheme& tiling_scheme,
139
+ llvm::Type* index_ty, const TileElementGenerator& tile_element_generator);
140
+
141
+ llvm_ir::IrArray::Index GetUnnormalizedIndex(
142
+ const llvm_ir::IrArray::Index& normalized_shape_index,
143
+ const Shape& unnormalized_shape, llvm::IRBuilder<>* builder,
144
+ absl::Span<const int64_t> dims_in_elems);
145
+
146
+ } // namespace gpu
147
+ } // namespace xla
148
+
149
+ #endif // XLA_SERVICE_GPU_FUSIONS_TILING_UTIL_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/fusions/transpose.h ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_FUSIONS_TRANSPOSE_H_
16
+ #define XLA_SERVICE_GPU_FUSIONS_TRANSPOSE_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "xla/hlo/ir/hlo_instructions.h"
21
+ #include "xla/mlir_hlo/lhlo/IR/lhlo_ops.h"
22
+ #include "xla/service/elemental_ir_emitter.h"
23
+ #include "xla/service/gpu/fusions/fusion_emitter.h"
24
+ #include "xla/service/gpu/hlo_fusion_analysis.h"
25
+ #include "xla/service/gpu/ir_emitter_context.h"
26
+
27
+ namespace xla {
28
+ namespace gpu {
29
+
30
+ // Emits a kernel for the given hlo instruction using a tiled 0-2-1 transpose
31
+ // algorithm to improve the memory access patterns for the input parameters
32
+ // with a shape that is a 0-2-1 transpose of the output tensor shape. The
33
+ // caller is responsible for making sure that it is safe to apply the shared
34
+ // memory transpose on the input parameters.
35
+ //
36
+ // For the purpose of tiling, the output tensors have a logical shape of three
37
+ // components 0-2-1 while the relevant input parameters have a logical shape
38
+ // of three components 0-1-2 in the order major to minor. The x- and y-
39
+ // dimensions of the tensors are tiled in square tiles with an edge length
40
+ // `kTileSize`. Each thread block of `kTileSize` x `kNumRows` threads
41
+ // transposes one tile: each thread copies kTileSize/kNumRows elements from
42
+ // the input to a shared memory tile, then the otherwise "regular HLO kernel"
43
+ // reads from the shared memory instead of the original input.
44
+ //
45
+ // This is similar to the following CUDA algorithm in TensorFlow:
46
+ // https://goo.gl/MStRV6.
47
+ //
48
+ // `kTileSize` should usually be same as warp size. We currently choose 32 for
49
+ // `kTileSize` and 4 for `kNumRows`. The CUDA algorithm uses 8 for `kNumRows`.
50
+ //
51
+ // TODO(b/33320379): Here each block transposes 1 tile. It may be more
52
+ // efficient to launch fewer blocks so each transposes many tiles.
53
+ class TransposeFusion : public KernelFusionEmitterBase {
54
+ public:
55
+ explicit TransposeFusion(HloFusionAnalysis& analysis) : analysis_(analysis) {}
56
+ StatusOr<LaunchDimensions> launch_dimensions(
57
+ IrEmitterContext& ir_emitter_context, int kernel_index) const override {
58
+ return analysis_.GetLaunchDimensions();
59
+ }
60
+
61
+ protected:
62
+ Status EmitKernel(IrEmitterContext& ir_emitter_context,
63
+ ElementalIrEmitter& elemental_emitter,
64
+ mlir::lmhlo::FusionOp fusion_op,
65
+ const HloFusionInstruction& fusion,
66
+ const LaunchDimensions& launch_dims,
67
+ std::vector<llvm_ir::IrArray> inputs,
68
+ std::vector<llvm_ir::IrArray> outputs,
69
+ llvm::IRBuilder<>* builder,
70
+ int kernel_index) const override;
71
+
72
+ private:
73
+ HloFusionAnalysis& analysis_;
74
+ };
75
+
76
+ } // namespace gpu
77
+ } // namespace xla
78
+
79
+ #endif // XLA_SERVICE_GPU_FUSIONS_TRANSPOSE_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_algorithm_picker.h ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_GEMM_ALGORITHM_PICKER_H_
16
+ #define XLA_SERVICE_GPU_GEMM_ALGORITHM_PICKER_H_
17
+
18
+ #include <functional>
19
+ #include <optional>
20
+ #include <string>
21
+ #include <string_view>
22
+ #include <variant>
23
+
24
+ #include "absl/strings/string_view.h"
25
+ #include "xla/autotune_results.pb.h"
26
+ #include "xla/autotuning.pb.h"
27
+ #include "xla/hlo/ir/hlo_instructions.h"
28
+ #include "xla/hlo/ir/hlo_module.h"
29
+ #include "xla/service/gpu/autotuner_util.h"
30
+ #include "xla/service/hlo_pass_interface.h"
31
+ #include "xla/stream_executor/device_description.h"
32
+ #include "xla/stream_executor/device_memory_allocator.h"
33
+ #include "xla/stream_executor/stream_executor.h"
34
+
35
+ #if (defined(GOOGLE_CUDA) && GOOGLE_CUDA)
36
+ #include "xla/service/gpu/gpu_conv_runner.h"
37
+ #include "xla/stream_executor/cuda/cuda_blas_lt.h"
38
+ #include "xla/stream_executor/gpu/redzone_allocator.h"
39
+ #endif
40
+
41
+ namespace xla {
42
+ namespace gpu {
43
+
44
+ StatusOr<AutotuneResult> GetBestBlasAlgorithm(
45
+ se::Stream* stream, se::RedzoneAllocator& allocator,
46
+ std::optional<std::string_view> gemm_str,
47
+ const AutotuneConfig& autotune_config, se::DeviceMemoryBase lhs_buffer,
48
+ se::DeviceMemoryBase rhs_buffer, se::DeviceMemoryBase output_buffer,
49
+ absl::Span<const se::blas::AlgorithmType> algorithms,
50
+ const Shape& output_shape, const HloModuleConfig& hlo_module_config,
51
+ double beta,
52
+ const std::function<StatusOr<se::blas::ProfileResult>(
53
+ const se::blas::AlgorithmType&)>& run_benchmark);
54
+
55
+ // GemmAlgorithmPicker supports two modes: device and deviceless.
56
+ // In device mode, we run autotuning on the device and store autotune results.
57
+ // In deviceless mode, we pass in some information related to the device and
58
+ // use stored autotune results to rewrite Gemm instructions. If the required
59
+ // autotune result is not stored, then algorithm is set to kRuntimeAutotuning.
60
+ class GemmAlgorithmPicker : public HloModulePass {
61
+ public:
62
+ explicit GemmAlgorithmPicker(AutotuneConfig config) : config_(config) {}
63
+
64
+ absl::string_view name() const override { return "gemm-algorithm-picker"; }
65
+
66
+ using HloPassInterface::Run;
67
+ StatusOr<bool> Run(
68
+ HloModule* module,
69
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
70
+
71
+ private:
72
+ AutotuneConfig config_;
73
+ };
74
+
75
+ } // namespace gpu
76
+ } // namespace xla
77
+
78
+ #endif // XLA_SERVICE_GPU_GEMM_ALGORITHM_PICKER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_broadcast_folding_rewriter.h ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_GEMM_BROADCAST_FOLDING_REWRITER_H_
16
+ #define XLA_SERVICE_GPU_GEMM_BROADCAST_FOLDING_REWRITER_H_
17
+
18
+ #include <optional>
19
+
20
+ #include "xla/hlo/ir/hlo_instructions.h"
21
+ #include "xla/hlo/ir/hlo_module.h"
22
+ #include "xla/service/hlo_pass_interface.h"
23
+
24
+ namespace xla {
25
+ namespace gpu {
26
+
27
+ // cuBLAS GEMM has support for strided batched calls, where the stride is used
28
+ // to determine the offset between the batches.
29
+ //
30
+ // This allows (kCustomCall:gemm A kBroadcast(B)) or
31
+ // (kCustomCall:gemm kBroadcast(A) B)
32
+ // to be rewritten as (kCustomCall:gemm A B) with a zero stride for the
33
+ // broadcasted operand if the broadcast operates on all the batch dimensions.
34
+ //
35
+ // This pattern matches the above case and removes the unnecessary broadcast.
36
+ class GemmBroadcastFoldingRewriter : public HloModulePass {
37
+ public:
38
+ absl::string_view name() const override {
39
+ return "cublas-gemm-broadcast-folding-rewriter";
40
+ }
41
+
42
+ using HloPassInterface::Run;
43
+ StatusOr<bool> Run(
44
+ HloModule* module,
45
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
46
+ };
47
+
48
+ } // namespace gpu
49
+ } // namespace xla
50
+
51
+ #endif // XLA_SERVICE_GPU_GEMM_BROADCAST_FOLDING_REWRITER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_rewriter.h ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_GEMM_REWRITER_H_
16
+ #define XLA_SERVICE_GPU_GEMM_REWRITER_H_
17
+
18
+ #include <optional>
19
+
20
+ #include "xla/hlo/ir/hlo_instructions.h"
21
+ #include "xla/hlo/ir/hlo_module.h"
22
+ #include "xla/service/hlo_pass_interface.h"
23
+ #include "xla/stream_executor/device_description.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ // cuBLAS GEMM in the most general form can run the following operation:
29
+ //
30
+ // (kAdd
31
+ // (kMultiply (kDot A B) alpha)
32
+ // (kMultiply C beta))
33
+ //
34
+ // where A, B, C are matrixes and `alpha` and `beta` are host constants.
35
+ // The additional requirement is that C has no other users (otherwise,
36
+ // it does not make sense to fuse it inside the custom call).
37
+ //
38
+ // Both multiplication and addition can be avoided (equivalent to setting
39
+ // `alpha` to one and `beta` to zero).
40
+ //
41
+ // This pass pattern-matches the most general form of this instruction
42
+ // (we assume transposes are already folded), and rewrites it into a custom call
43
+ // where (A, B, C) are three operands respectively, and `alpha` and `beta` are
44
+ // stored in the backend config.
45
+ class GemmRewriter : public HloModulePass {
46
+ public:
47
+ explicit GemmRewriter(se::GpuComputeCapability gpu_version);
48
+ absl::string_view name() const override { return "cublas-gemm-rewriter"; }
49
+
50
+ using HloPassInterface::Run;
51
+ StatusOr<bool> Run(
52
+ HloModule* module,
53
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
54
+
55
+ private:
56
+ se::GpuComputeCapability gpu_version_;
57
+ };
58
+
59
+ } // namespace gpu
60
+ } // namespace xla
61
+
62
+ #endif // XLA_SERVICE_GPU_GEMM_REWRITER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_rewriter_triton.h ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ #ifndef XLA_SERVICE_GPU_GEMM_REWRITER_TRITON_H_
16
+ #define XLA_SERVICE_GPU_GEMM_REWRITER_TRITON_H_
17
+
18
+ #include <cstdint>
19
+ #include <string>
20
+ #include <vector>
21
+
22
+ #include "absl/container/flat_hash_map.h"
23
+ #include "absl/container/flat_hash_set.h"
24
+ #include "absl/strings/string_view.h"
25
+ #include "xla/autotuning.pb.h"
26
+ #include "xla/hlo/ir/hlo_computation.h"
27
+ #include "xla/hlo/ir/hlo_instruction.h"
28
+ #include "xla/hlo/ir/hlo_module.h"
29
+ #include "xla/hlo/ir/hlo_opcode.h"
30
+ #include "xla/service/hlo_pass_interface.h"
31
+ #include "xla/service/instruction_fusion.h"
32
+ #include "xla/status.h"
33
+ #include "xla/statusor.h"
34
+ #include "xla/stream_executor/device_description.h"
35
+ #include "xla/xla_data.pb.h"
36
+
37
+ namespace xla {
38
+ namespace gpu {
39
+
40
+ // Tells if f(a+b) == f(a) + f(b).
41
+ bool IsDistributiveOverAddition(const HloInstruction& hlo);
42
+
43
+ // Allowlist of unary elementwise operations supported by Triton GEMM codegen.
44
+ std::vector<HloOpcode> TritonSupportedUnaryElementwise(PrimitiveType);
45
+
46
+ // Allowlist of binary elementwise operations supported by Triton GEMM codegen.
47
+ std::vector<HloOpcode> TritonSupportedBinaryElementwise(PrimitiveType);
48
+
49
+ // Allowlist of ternary elementwise operations supported by Triton GEMM codegen.
50
+ std::vector<HloOpcode> TritonSupportedTernaryElementwise(PrimitiveType);
51
+
52
+ // Data types that are supported by the Triton emitters.
53
+ bool IsTritonSupportedDataType(PrimitiveType, se::GpuComputeCapability);
54
+
55
+ // Checks elementwise operation against all supported by Triton GEMM codegen.
56
+ bool IsTritonSupportedElementwise(HloOpcode, PrimitiveType);
57
+
58
+ // Filters GEMMs which can be handled using Triton.
59
+ FusionDecision CanTritonHandleGEMM(const HloInstruction&,
60
+ se::GpuComputeCapability gpu_version);
61
+
62
+ // Filters GEMMs which are better to handle using Triton.
63
+ bool ShouldTritonHandleGEMM(HloInstruction&,
64
+ se::GpuComputeCapability gpu_version);
65
+
66
+ class TensorIterationSpec {
67
+ public:
68
+ // Description of basic iteration: `count` elements separated by `stride`.
69
+ struct IterationSpecFragment {
70
+ int64_t stride;
71
+ int64_t count;
72
+ int64_t slice_start;
73
+ int64_t slice_limit;
74
+ // Logical subfragments when this iteration is composed
75
+ // of several HLO dimensions.
76
+ std::vector<int64_t> subfragments;
77
+
78
+ bool is_sliced() const { return count != slice_limit - slice_start; }
79
+ bool operator!=(const IterationSpecFragment& other) const;
80
+ std::string ToString() const;
81
+ };
82
+ // Description of complex iteration over a sequence of several strides.
83
+ // Describes a logically contiguous dimension of a tensor physically
84
+ // separated into multiple fragments by other dimensions.
85
+ using DimIterationSpec = std::vector<IterationSpecFragment>;
86
+
87
+ using StorageType = absl::flat_hash_map<int, DimIterationSpec>;
88
+ const DimIterationSpec& operator[](const int dimension) const {
89
+ return dim_iteration_specs_.at(dimension);
90
+ }
91
+ DimIterationSpec& operator[](const int dimension) {
92
+ return dim_iteration_specs_[dimension];
93
+ }
94
+ const StorageType& Storage() const { return dim_iteration_specs_; }
95
+ void RemoveEmptyDimensions() {
96
+ absl::erase_if(dim_iteration_specs_,
97
+ [](const auto& it) { return it.second.empty(); });
98
+ }
99
+
100
+ // Compares physical layouts of tensors ignoring subfragments of dimensions.
101
+ bool operator==(const TensorIterationSpec& other) const;
102
+
103
+ std::string ToString() const;
104
+
105
+ private:
106
+ StorageType dim_iteration_specs_;
107
+ };
108
+
109
+ // Analysis of tensor iteration orders within tiled fusions.
110
+ class TritonFusionAnalysis {
111
+ Status ExecuteForDotFusion(const HloInstruction& dot, int split_k);
112
+ Status ExecuteForSoftmaxFusion(const HloInstruction& root);
113
+
114
+ public:
115
+ // Execute the analysis of a fusion computation.
116
+ // `split_k` indicates whether this operation was converted to the split-K
117
+ // form and tells the analysis how to interpret the batch dimensions.
118
+ static StatusOr<TritonFusionAnalysis> Execute(
119
+ const HloComputation& computation, int split_k = 1);
120
+
121
+ // A scope is an HLO graph that can be tiled efficiently using same or
122
+ // compatible tile shapes on all operations. GEMM fusion has 3 scopes
123
+ // defined by left operand, right operand and output.
124
+ enum class Scope { LHS = 0, RHS = 1, OUTPUT = 2 };
125
+
126
+ using IterationSpecByInstructionMap =
127
+ ConstHloInstructionMap<TensorIterationSpec>;
128
+ using IterationSpecByInstructionByScopeMap =
129
+ std::map<Scope, IterationSpecByInstructionMap>;
130
+
131
+ // Every parameter requires a separate piece of shared memory for asynchronous
132
+ // loads. Multiple parameters are approximately equivalent to multiple
133
+ // pipeline stages.
134
+ static constexpr int kMaxParameterPerScope = 4;
135
+
136
+ // Scope -> HLO -> dot dimension number -> iteration spec at the HLO's output.
137
+ const TensorIterationSpec::DimIterationSpec* IterSpec(Scope scope,
138
+ const HloInstruction*,
139
+ int dimension) const;
140
+ // Parameter HLO instructions used in a scope of `dot`.
141
+ const ConstHloInstructionSet& ScopeParameters(const Scope scope) const {
142
+ return parameters_.at(scope);
143
+ }
144
+
145
+ std::string ToString() const;
146
+
147
+ private:
148
+ IterationSpecByInstructionByScopeMap iter_specs_;
149
+ // HLO computation parameters per scope.
150
+ std::map<Scope, ConstHloInstructionSet> parameters_;
151
+ };
152
+
153
+ // Rewrite compatible dot() calls into custom calls with fused computations
154
+ // that target Triton-based matmul emitter.
155
+ class GemmRewriterTriton : public HloModulePass {
156
+ public:
157
+ explicit GemmRewriterTriton(se::GpuComputeCapability gpu_version)
158
+ : gpu_version_(gpu_version) {}
159
+ absl::string_view name() const override { return "triton-gemm-rewriter"; }
160
+
161
+ using HloPassInterface::Run;
162
+ StatusOr<bool> Run(
163
+ HloModule* module,
164
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
165
+
166
+ private:
167
+ se::GpuComputeCapability gpu_version_;
168
+ };
169
+
170
+ } // namespace gpu
171
+ } // namespace xla
172
+
173
+ #endif // XLA_SERVICE_GPU_GEMM_REWRITER_TRITON_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gemm_thunk.h ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_GEMM_THUNK_H_
17
+ #define XLA_SERVICE_GPU_GEMM_THUNK_H_
18
+
19
+ #include "xla/service/buffer_assignment.h"
20
+ #include "xla/service/gpu/matmul_utils.h"
21
+ #include "xla/service/gpu/thunk.h"
22
+ #include "xla/status.h"
23
+ #include "xla/stream_executor/stream_executor.h"
24
+
25
+ namespace xla {
26
+ namespace gpu {
27
+
28
+ // This is thread-compatible.
29
+ class GemmThunk : public Thunk {
30
+ public:
31
+ // Constructs a thunk that computes "output = (lhs <dot> rhs) * alpha" using
32
+ // BLAS gemm (alpha is stored in the instruction GemmBackendConfig).
33
+ GemmThunk(ThunkInfo thunk_info, GemmConfig config,
34
+ const BufferAllocation::Slice& lhs_buffer,
35
+ const BufferAllocation::Slice& rhs_buffer,
36
+ const BufferAllocation::Slice& output_buffer, bool deterministic);
37
+
38
+ GemmThunk(const GemmThunk&) = delete;
39
+ GemmThunk& operator=(const GemmThunk&) = delete;
40
+
41
+ Status ExecuteOnStream(const ExecuteParams& params) override;
42
+ Status Initialize(const GpuExecutable& executable,
43
+ se::StreamExecutor* executor) override;
44
+
45
+ private:
46
+ const GemmConfig config_;
47
+ const BufferAllocation::Slice lhs_buffer_;
48
+ const BufferAllocation::Slice rhs_buffer_;
49
+ const BufferAllocation::Slice output_buffer_;
50
+ // Whether to run deterministically.
51
+ const bool deterministic_;
52
+ };
53
+
54
+ } // namespace gpu
55
+ } // namespace xla
56
+
57
+ #endif // XLA_SERVICE_GPU_GEMM_THUNK_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_all_gather_optimizer.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_GPU_ALL_GATHER_OPTIMIZER_H_
17
+ #define XLA_SERVICE_GPU_GPU_ALL_GATHER_OPTIMIZER_H_
18
+
19
+ #include "xla/service/hlo_pass_interface.h"
20
+
21
+ namespace xla {
22
+ namespace gpu {
23
+
24
+ // Transforms binary_op(all-gather(reduce_scatter(a)),
25
+ // all-gather(reduce_scatter(b))) to allgather(binary_op(reduce_scatter(a),
26
+ // reduce_scatter(b)))
27
+
28
+ class AllGatherOptimizer : public HloModulePass {
29
+ public:
30
+ AllGatherOptimizer() = default;
31
+ absl::string_view name() const override { return "all-gather-optimizer"; }
32
+
33
+ using HloPassInterface::Run;
34
+ StatusOr<bool> Run(
35
+ HloModule* module,
36
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
37
+ };
38
+
39
+ } // namespace gpu
40
+ } // namespace xla
41
+
42
+ #endif // XLA_SERVICE_GPU_GPU_ALL_GATHER_OPTIMIZER_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_asm_opts_util.h ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_GPU_ASM_OPTS_UTIL_H_
17
+ #define XLA_SERVICE_GPU_GPU_ASM_OPTS_UTIL_H_
18
+
19
+ #include "xla/stream_executor/gpu/gpu_asm_opts.h"
20
+ #include "xla/xla.pb.h"
21
+
22
+ namespace xla {
23
+ namespace gpu {
24
+
25
+ // Create GpuAsmOpts out of DebugOptions.
26
+ stream_executor::GpuAsmOpts PtxOptsFromDebugOptions(
27
+ const DebugOptions& debug_options);
28
+
29
+ } // namespace gpu
30
+ } // namespace xla
31
+
32
+ #endif // XLA_SERVICE_GPU_GPU_ASM_OPTS_UTIL_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_async_collective_annotator.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef XLA_SERVICE_GPU_GPU_ASYNC_COLLECTIVE_ANNOTATOR_H_
17
+ #define XLA_SERVICE_GPU_GPU_ASYNC_COLLECTIVE_ANNOTATOR_H_
18
+
19
+ #include <utility>
20
+
21
+ #include "xla/service/hlo_pass_interface.h"
22
+
23
+ namespace xla {
24
+ namespace gpu {
25
+
26
+ // Annotate async collectives with CollectiveBackendConfig.
27
+ class GpuAsyncCollectiveAnnotator : public HloModulePass {
28
+ public:
29
+ explicit GpuAsyncCollectiveAnnotator(HloPredicate is_collective_async)
30
+ : is_collective_async_(std::move(is_collective_async)) {}
31
+ absl::string_view name() const override {
32
+ return "gpu-async-collective-annotator";
33
+ }
34
+
35
+ using HloPassInterface::Run;
36
+ StatusOr<bool> Run(
37
+ HloModule* module,
38
+ const absl::flat_hash_set<absl::string_view>& execution_threads) override;
39
+
40
+ private:
41
+ HloPredicate is_collective_async_;
42
+ };
43
+
44
+ } // namespace gpu
45
+ } // namespace xla
46
+
47
+ #endif // XLA_SERVICE_GPU_GPU_ASYNC_COLLECTIVE_ANNOTATOR_H_
miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/service/gpu/gpu_autotuning.pb.h ADDED
@@ -0,0 +1,1494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ // source: xla/service/gpu/gpu_autotuning.proto
3
+
4
+ #ifndef GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto
5
+ #define GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto
6
+
7
+ #include <limits>
8
+ #include <string>
9
+
10
+ #include <google/protobuf/port_def.inc>
11
+ #if PROTOBUF_VERSION < 3021000
12
+ #error This file was generated by a newer version of protoc which is
13
+ #error incompatible with your Protocol Buffer headers. Please update
14
+ #error your headers.
15
+ #endif
16
+ #if 3021009 < PROTOBUF_MIN_PROTOC_VERSION
17
+ #error This file was generated by an older version of protoc which is
18
+ #error incompatible with your Protocol Buffer headers. Please
19
+ #error regenerate this file with a newer version of protoc.
20
+ #endif
21
+
22
+ #include <google/protobuf/port_undef.inc>
23
+ #include <google/protobuf/io/coded_stream.h>
24
+ #include <google/protobuf/arena.h>
25
+ #include <google/protobuf/arenastring.h>
26
+ #include <google/protobuf/generated_message_util.h>
27
+ #include <google/protobuf/metadata_lite.h>
28
+ #include <google/protobuf/generated_message_reflection.h>
29
+ #include <google/protobuf/message.h>
30
+ #include <google/protobuf/repeated_field.h> // IWYU pragma: export
31
+ #include <google/protobuf/extension_set.h> // IWYU pragma: export
32
+ #include <google/protobuf/unknown_field_set.h>
33
+ #include "xla/autotuning.pb.h"
34
+ #include "xla/service/hlo.pb.h"
35
+ #include "xla/xla_data.pb.h"
36
+ // @@protoc_insertion_point(includes)
37
+ #include <google/protobuf/port_def.inc>
38
+ #define PROTOBUF_INTERNAL_EXPORT_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto
39
+ PROTOBUF_NAMESPACE_OPEN
40
+ namespace internal {
41
+ class AnyMetadata;
42
+ } // namespace internal
43
+ PROTOBUF_NAMESPACE_CLOSE
44
+
45
+ // Internal implementation detail -- do not use these members.
46
+ struct TableStruct_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto {
47
+ static const uint32_t offsets[];
48
+ };
49
+ extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto;
50
+ namespace xla {
51
+ namespace gpu {
52
+ class AlgorithmDenylist;
53
+ struct AlgorithmDenylistDefaultTypeInternal;
54
+ extern AlgorithmDenylistDefaultTypeInternal _AlgorithmDenylist_default_instance_;
55
+ class AlgorithmDenylistEntry;
56
+ struct AlgorithmDenylistEntryDefaultTypeInternal;
57
+ extern AlgorithmDenylistEntryDefaultTypeInternal _AlgorithmDenylistEntry_default_instance_;
58
+ class ConvInstructionLog;
59
+ struct ConvInstructionLogDefaultTypeInternal;
60
+ extern ConvInstructionLogDefaultTypeInternal _ConvInstructionLog_default_instance_;
61
+ class DenylistedAlgorithm;
62
+ struct DenylistedAlgorithmDefaultTypeInternal;
63
+ extern DenylistedAlgorithmDefaultTypeInternal _DenylistedAlgorithm_default_instance_;
64
+ } // namespace gpu
65
+ } // namespace xla
66
+ PROTOBUF_NAMESPACE_OPEN
67
+ template<> ::xla::gpu::AlgorithmDenylist* Arena::CreateMaybeMessage<::xla::gpu::AlgorithmDenylist>(Arena*);
68
+ template<> ::xla::gpu::AlgorithmDenylistEntry* Arena::CreateMaybeMessage<::xla::gpu::AlgorithmDenylistEntry>(Arena*);
69
+ template<> ::xla::gpu::ConvInstructionLog* Arena::CreateMaybeMessage<::xla::gpu::ConvInstructionLog>(Arena*);
70
+ template<> ::xla::gpu::DenylistedAlgorithm* Arena::CreateMaybeMessage<::xla::gpu::DenylistedAlgorithm>(Arena*);
71
+ PROTOBUF_NAMESPACE_CLOSE
72
+ namespace xla {
73
+ namespace gpu {
74
+
75
+ // ===================================================================
76
+
77
+ class ConvInstructionLog final :
78
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.ConvInstructionLog) */ {
79
+ public:
80
+ inline ConvInstructionLog() : ConvInstructionLog(nullptr) {}
81
+ ~ConvInstructionLog() override;
82
+ explicit PROTOBUF_CONSTEXPR ConvInstructionLog(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
83
+
84
+ ConvInstructionLog(const ConvInstructionLog& from);
85
+ ConvInstructionLog(ConvInstructionLog&& from) noexcept
86
+ : ConvInstructionLog() {
87
+ *this = ::std::move(from);
88
+ }
89
+
90
+ inline ConvInstructionLog& operator=(const ConvInstructionLog& from) {
91
+ CopyFrom(from);
92
+ return *this;
93
+ }
94
+ inline ConvInstructionLog& operator=(ConvInstructionLog&& from) noexcept {
95
+ if (this == &from) return *this;
96
+ if (GetOwningArena() == from.GetOwningArena()
97
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
98
+ && GetOwningArena() != nullptr
99
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
100
+ ) {
101
+ InternalSwap(&from);
102
+ } else {
103
+ CopyFrom(from);
104
+ }
105
+ return *this;
106
+ }
107
+
108
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
109
+ return GetDescriptor();
110
+ }
111
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
112
+ return default_instance().GetMetadata().descriptor;
113
+ }
114
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
115
+ return default_instance().GetMetadata().reflection;
116
+ }
117
+ static const ConvInstructionLog& default_instance() {
118
+ return *internal_default_instance();
119
+ }
120
+ static inline const ConvInstructionLog* internal_default_instance() {
121
+ return reinterpret_cast<const ConvInstructionLog*>(
122
+ &_ConvInstructionLog_default_instance_);
123
+ }
124
+ static constexpr int kIndexInFileMessages =
125
+ 0;
126
+
127
+ friend void swap(ConvInstructionLog& a, ConvInstructionLog& b) {
128
+ a.Swap(&b);
129
+ }
130
+ inline void Swap(ConvInstructionLog* other) {
131
+ if (other == this) return;
132
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
133
+ if (GetOwningArena() != nullptr &&
134
+ GetOwningArena() == other->GetOwningArena()) {
135
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
136
+ if (GetOwningArena() == other->GetOwningArena()) {
137
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
138
+ InternalSwap(other);
139
+ } else {
140
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
141
+ }
142
+ }
143
+ void UnsafeArenaSwap(ConvInstructionLog* other) {
144
+ if (other == this) return;
145
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
146
+ InternalSwap(other);
147
+ }
148
+
149
+ // implements Message ----------------------------------------------
150
+
151
+ ConvInstructionLog* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
152
+ return CreateMaybeMessage<ConvInstructionLog>(arena);
153
+ }
154
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
155
+ void CopyFrom(const ConvInstructionLog& from);
156
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
157
+ void MergeFrom( const ConvInstructionLog& from) {
158
+ ConvInstructionLog::MergeImpl(*this, from);
159
+ }
160
+ private:
161
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
162
+ public:
163
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
164
+ bool IsInitialized() const final;
165
+
166
+ size_t ByteSizeLong() const final;
167
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
168
+ uint8_t* _InternalSerialize(
169
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
170
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
171
+
172
+ private:
173
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
174
+ void SharedDtor();
175
+ void SetCachedSize(int size) const final;
176
+ void InternalSwap(ConvInstructionLog* other);
177
+
178
+ private:
179
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
180
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
181
+ return "xla.gpu.ConvInstructionLog";
182
+ }
183
+ protected:
184
+ explicit ConvInstructionLog(::PROTOBUF_NAMESPACE_ID::Arena* arena,
185
+ bool is_message_owned = false);
186
+ public:
187
+
188
+ static const ClassData _class_data_;
189
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
190
+
191
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
192
+
193
+ // nested types ----------------------------------------------------
194
+
195
+ // accessors -------------------------------------------------------
196
+
197
+ enum : int {
198
+ kOperandShapesFieldNumber = 2,
199
+ kResultAddressesFieldNumber = 3,
200
+ kOperandAddressesFieldNumber = 4,
201
+ kInstructionFieldNumber = 1,
202
+ };
203
+ // repeated .xla.ShapeProto operand_shapes = 2;
204
+ int operand_shapes_size() const;
205
+ private:
206
+ int _internal_operand_shapes_size() const;
207
+ public:
208
+ void clear_operand_shapes();
209
+ ::xla::ShapeProto* mutable_operand_shapes(int index);
210
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::ShapeProto >*
211
+ mutable_operand_shapes();
212
+ private:
213
+ const ::xla::ShapeProto& _internal_operand_shapes(int index) const;
214
+ ::xla::ShapeProto* _internal_add_operand_shapes();
215
+ public:
216
+ const ::xla::ShapeProto& operand_shapes(int index) const;
217
+ ::xla::ShapeProto* add_operand_shapes();
218
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::ShapeProto >&
219
+ operand_shapes() const;
220
+
221
+ // repeated uint64 result_addresses = 3;
222
+ int result_addresses_size() const;
223
+ private:
224
+ int _internal_result_addresses_size() const;
225
+ public:
226
+ void clear_result_addresses();
227
+ private:
228
+ uint64_t _internal_result_addresses(int index) const;
229
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
230
+ _internal_result_addresses() const;
231
+ void _internal_add_result_addresses(uint64_t value);
232
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
233
+ _internal_mutable_result_addresses();
234
+ public:
235
+ uint64_t result_addresses(int index) const;
236
+ void set_result_addresses(int index, uint64_t value);
237
+ void add_result_addresses(uint64_t value);
238
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
239
+ result_addresses() const;
240
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
241
+ mutable_result_addresses();
242
+
243
+ // repeated uint64 operand_addresses = 4;
244
+ int operand_addresses_size() const;
245
+ private:
246
+ int _internal_operand_addresses_size() const;
247
+ public:
248
+ void clear_operand_addresses();
249
+ private:
250
+ uint64_t _internal_operand_addresses(int index) const;
251
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
252
+ _internal_operand_addresses() const;
253
+ void _internal_add_operand_addresses(uint64_t value);
254
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
255
+ _internal_mutable_operand_addresses();
256
+ public:
257
+ uint64_t operand_addresses(int index) const;
258
+ void set_operand_addresses(int index, uint64_t value);
259
+ void add_operand_addresses(uint64_t value);
260
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
261
+ operand_addresses() const;
262
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
263
+ mutable_operand_addresses();
264
+
265
+ // .xla.HloInstructionProto instruction = 1;
266
+ bool has_instruction() const;
267
+ private:
268
+ bool _internal_has_instruction() const;
269
+ public:
270
+ void clear_instruction();
271
+ const ::xla::HloInstructionProto& instruction() const;
272
+ PROTOBUF_NODISCARD ::xla::HloInstructionProto* release_instruction();
273
+ ::xla::HloInstructionProto* mutable_instruction();
274
+ void set_allocated_instruction(::xla::HloInstructionProto* instruction);
275
+ private:
276
+ const ::xla::HloInstructionProto& _internal_instruction() const;
277
+ ::xla::HloInstructionProto* _internal_mutable_instruction();
278
+ public:
279
+ void unsafe_arena_set_allocated_instruction(
280
+ ::xla::HloInstructionProto* instruction);
281
+ ::xla::HloInstructionProto* unsafe_arena_release_instruction();
282
+
283
+ // @@protoc_insertion_point(class_scope:xla.gpu.ConvInstructionLog)
284
+ private:
285
+ class _Internal;
286
+
287
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
288
+ typedef void InternalArenaConstructable_;
289
+ typedef void DestructorSkippable_;
290
+ struct Impl_ {
291
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::ShapeProto > operand_shapes_;
292
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t > result_addresses_;
293
+ mutable std::atomic<int> _result_addresses_cached_byte_size_;
294
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t > operand_addresses_;
295
+ mutable std::atomic<int> _operand_addresses_cached_byte_size_;
296
+ ::xla::HloInstructionProto* instruction_;
297
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
298
+ };
299
+ union { Impl_ _impl_; };
300
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto;
301
+ };
302
+ // -------------------------------------------------------------------
303
+
304
+ class DenylistedAlgorithm final :
305
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.DenylistedAlgorithm) */ {
306
+ public:
307
+ inline DenylistedAlgorithm() : DenylistedAlgorithm(nullptr) {}
308
+ ~DenylistedAlgorithm() override;
309
+ explicit PROTOBUF_CONSTEXPR DenylistedAlgorithm(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
310
+
311
+ DenylistedAlgorithm(const DenylistedAlgorithm& from);
312
+ DenylistedAlgorithm(DenylistedAlgorithm&& from) noexcept
313
+ : DenylistedAlgorithm() {
314
+ *this = ::std::move(from);
315
+ }
316
+
317
+ inline DenylistedAlgorithm& operator=(const DenylistedAlgorithm& from) {
318
+ CopyFrom(from);
319
+ return *this;
320
+ }
321
+ inline DenylistedAlgorithm& operator=(DenylistedAlgorithm&& from) noexcept {
322
+ if (this == &from) return *this;
323
+ if (GetOwningArena() == from.GetOwningArena()
324
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
325
+ && GetOwningArena() != nullptr
326
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
327
+ ) {
328
+ InternalSwap(&from);
329
+ } else {
330
+ CopyFrom(from);
331
+ }
332
+ return *this;
333
+ }
334
+
335
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
336
+ return GetDescriptor();
337
+ }
338
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
339
+ return default_instance().GetMetadata().descriptor;
340
+ }
341
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
342
+ return default_instance().GetMetadata().reflection;
343
+ }
344
+ static const DenylistedAlgorithm& default_instance() {
345
+ return *internal_default_instance();
346
+ }
347
+ static inline const DenylistedAlgorithm* internal_default_instance() {
348
+ return reinterpret_cast<const DenylistedAlgorithm*>(
349
+ &_DenylistedAlgorithm_default_instance_);
350
+ }
351
+ static constexpr int kIndexInFileMessages =
352
+ 1;
353
+
354
+ friend void swap(DenylistedAlgorithm& a, DenylistedAlgorithm& b) {
355
+ a.Swap(&b);
356
+ }
357
+ inline void Swap(DenylistedAlgorithm* other) {
358
+ if (other == this) return;
359
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
360
+ if (GetOwningArena() != nullptr &&
361
+ GetOwningArena() == other->GetOwningArena()) {
362
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
363
+ if (GetOwningArena() == other->GetOwningArena()) {
364
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
365
+ InternalSwap(other);
366
+ } else {
367
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
368
+ }
369
+ }
370
+ void UnsafeArenaSwap(DenylistedAlgorithm* other) {
371
+ if (other == this) return;
372
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
373
+ InternalSwap(other);
374
+ }
375
+
376
+ // implements Message ----------------------------------------------
377
+
378
+ DenylistedAlgorithm* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
379
+ return CreateMaybeMessage<DenylistedAlgorithm>(arena);
380
+ }
381
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
382
+ void CopyFrom(const DenylistedAlgorithm& from);
383
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
384
+ void MergeFrom( const DenylistedAlgorithm& from) {
385
+ DenylistedAlgorithm::MergeImpl(*this, from);
386
+ }
387
+ private:
388
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
389
+ public:
390
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
391
+ bool IsInitialized() const final;
392
+
393
+ size_t ByteSizeLong() const final;
394
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
395
+ uint8_t* _InternalSerialize(
396
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
397
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
398
+
399
+ private:
400
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
401
+ void SharedDtor();
402
+ void SetCachedSize(int size) const final;
403
+ void InternalSwap(DenylistedAlgorithm* other);
404
+
405
+ private:
406
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
407
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
408
+ return "xla.gpu.DenylistedAlgorithm";
409
+ }
410
+ protected:
411
+ explicit DenylistedAlgorithm(::PROTOBUF_NAMESPACE_ID::Arena* arena,
412
+ bool is_message_owned = false);
413
+ public:
414
+
415
+ static const ClassData _class_data_;
416
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
417
+
418
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
419
+
420
+ // nested types ----------------------------------------------------
421
+
422
+ // accessors -------------------------------------------------------
423
+
424
+ enum : int {
425
+ kIdFieldNumber = 1,
426
+ kTensorOpsFieldNumber = 2,
427
+ };
428
+ // int64 id = 1;
429
+ void clear_id();
430
+ int64_t id() const;
431
+ void set_id(int64_t value);
432
+ private:
433
+ int64_t _internal_id() const;
434
+ void _internal_set_id(int64_t value);
435
+ public:
436
+
437
+ // bool tensor_ops = 2;
438
+ void clear_tensor_ops();
439
+ bool tensor_ops() const;
440
+ void set_tensor_ops(bool value);
441
+ private:
442
+ bool _internal_tensor_ops() const;
443
+ void _internal_set_tensor_ops(bool value);
444
+ public:
445
+
446
+ // @@protoc_insertion_point(class_scope:xla.gpu.DenylistedAlgorithm)
447
+ private:
448
+ class _Internal;
449
+
450
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
451
+ typedef void InternalArenaConstructable_;
452
+ typedef void DestructorSkippable_;
453
+ struct Impl_ {
454
+ int64_t id_;
455
+ bool tensor_ops_;
456
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
457
+ };
458
+ union { Impl_ _impl_; };
459
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto;
460
+ };
461
+ // -------------------------------------------------------------------
462
+
463
+ class AlgorithmDenylistEntry final :
464
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.AlgorithmDenylistEntry) */ {
465
+ public:
466
+ inline AlgorithmDenylistEntry() : AlgorithmDenylistEntry(nullptr) {}
467
+ ~AlgorithmDenylistEntry() override;
468
+ explicit PROTOBUF_CONSTEXPR AlgorithmDenylistEntry(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
469
+
470
+ AlgorithmDenylistEntry(const AlgorithmDenylistEntry& from);
471
+ AlgorithmDenylistEntry(AlgorithmDenylistEntry&& from) noexcept
472
+ : AlgorithmDenylistEntry() {
473
+ *this = ::std::move(from);
474
+ }
475
+
476
+ inline AlgorithmDenylistEntry& operator=(const AlgorithmDenylistEntry& from) {
477
+ CopyFrom(from);
478
+ return *this;
479
+ }
480
+ inline AlgorithmDenylistEntry& operator=(AlgorithmDenylistEntry&& from) noexcept {
481
+ if (this == &from) return *this;
482
+ if (GetOwningArena() == from.GetOwningArena()
483
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
484
+ && GetOwningArena() != nullptr
485
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
486
+ ) {
487
+ InternalSwap(&from);
488
+ } else {
489
+ CopyFrom(from);
490
+ }
491
+ return *this;
492
+ }
493
+
494
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
495
+ return GetDescriptor();
496
+ }
497
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
498
+ return default_instance().GetMetadata().descriptor;
499
+ }
500
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
501
+ return default_instance().GetMetadata().reflection;
502
+ }
503
+ static const AlgorithmDenylistEntry& default_instance() {
504
+ return *internal_default_instance();
505
+ }
506
+ static inline const AlgorithmDenylistEntry* internal_default_instance() {
507
+ return reinterpret_cast<const AlgorithmDenylistEntry*>(
508
+ &_AlgorithmDenylistEntry_default_instance_);
509
+ }
510
+ static constexpr int kIndexInFileMessages =
511
+ 2;
512
+
513
+ friend void swap(AlgorithmDenylistEntry& a, AlgorithmDenylistEntry& b) {
514
+ a.Swap(&b);
515
+ }
516
+ inline void Swap(AlgorithmDenylistEntry* other) {
517
+ if (other == this) return;
518
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
519
+ if (GetOwningArena() != nullptr &&
520
+ GetOwningArena() == other->GetOwningArena()) {
521
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
522
+ if (GetOwningArena() == other->GetOwningArena()) {
523
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
524
+ InternalSwap(other);
525
+ } else {
526
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
527
+ }
528
+ }
529
+ void UnsafeArenaSwap(AlgorithmDenylistEntry* other) {
530
+ if (other == this) return;
531
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
532
+ InternalSwap(other);
533
+ }
534
+
535
+ // implements Message ----------------------------------------------
536
+
537
+ AlgorithmDenylistEntry* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
538
+ return CreateMaybeMessage<AlgorithmDenylistEntry>(arena);
539
+ }
540
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
541
+ void CopyFrom(const AlgorithmDenylistEntry& from);
542
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
543
+ void MergeFrom( const AlgorithmDenylistEntry& from) {
544
+ AlgorithmDenylistEntry::MergeImpl(*this, from);
545
+ }
546
+ private:
547
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
548
+ public:
549
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
550
+ bool IsInitialized() const final;
551
+
552
+ size_t ByteSizeLong() const final;
553
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
554
+ uint8_t* _InternalSerialize(
555
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
556
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
557
+
558
+ private:
559
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
560
+ void SharedDtor();
561
+ void SetCachedSize(int size) const final;
562
+ void InternalSwap(AlgorithmDenylistEntry* other);
563
+
564
+ private:
565
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
566
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
567
+ return "xla.gpu.AlgorithmDenylistEntry";
568
+ }
569
+ protected:
570
+ explicit AlgorithmDenylistEntry(::PROTOBUF_NAMESPACE_ID::Arena* arena,
571
+ bool is_message_owned = false);
572
+ public:
573
+
574
+ static const ClassData _class_data_;
575
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
576
+
577
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
578
+
579
+ // nested types ----------------------------------------------------
580
+
581
+ // accessors -------------------------------------------------------
582
+
583
+ enum : int {
584
+ kAlgosFieldNumber = 4,
585
+ kHloFieldNumber = 1,
586
+ kBlasVersionFieldNumber = 5,
587
+ kCcFieldNumber = 2,
588
+ kCudnnVersionFieldNumber = 3,
589
+ };
590
+ // repeated .xla.gpu.DenylistedAlgorithm algos = 4;
591
+ int algos_size() const;
592
+ private:
593
+ int _internal_algos_size() const;
594
+ public:
595
+ void clear_algos();
596
+ ::xla::gpu::DenylistedAlgorithm* mutable_algos(int index);
597
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::DenylistedAlgorithm >*
598
+ mutable_algos();
599
+ private:
600
+ const ::xla::gpu::DenylistedAlgorithm& _internal_algos(int index) const;
601
+ ::xla::gpu::DenylistedAlgorithm* _internal_add_algos();
602
+ public:
603
+ const ::xla::gpu::DenylistedAlgorithm& algos(int index) const;
604
+ ::xla::gpu::DenylistedAlgorithm* add_algos();
605
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::DenylistedAlgorithm >&
606
+ algos() const;
607
+
608
+ // string hlo = 1;
609
+ void clear_hlo();
610
+ const std::string& hlo() const;
611
+ template <typename ArgT0 = const std::string&, typename... ArgT>
612
+ void set_hlo(ArgT0&& arg0, ArgT... args);
613
+ std::string* mutable_hlo();
614
+ PROTOBUF_NODISCARD std::string* release_hlo();
615
+ void set_allocated_hlo(std::string* hlo);
616
+ private:
617
+ const std::string& _internal_hlo() const;
618
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_hlo(const std::string& value);
619
+ std::string* _internal_mutable_hlo();
620
+ public:
621
+
622
+ // string blas_version = 5;
623
+ void clear_blas_version();
624
+ const std::string& blas_version() const;
625
+ template <typename ArgT0 = const std::string&, typename... ArgT>
626
+ void set_blas_version(ArgT0&& arg0, ArgT... args);
627
+ std::string* mutable_blas_version();
628
+ PROTOBUF_NODISCARD std::string* release_blas_version();
629
+ void set_allocated_blas_version(std::string* blas_version);
630
+ private:
631
+ const std::string& _internal_blas_version() const;
632
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_blas_version(const std::string& value);
633
+ std::string* _internal_mutable_blas_version();
634
+ public:
635
+
636
+ // .xla.ComputeCapability cc = 2;
637
+ bool has_cc() const;
638
+ private:
639
+ bool _internal_has_cc() const;
640
+ public:
641
+ void clear_cc();
642
+ const ::xla::ComputeCapability& cc() const;
643
+ PROTOBUF_NODISCARD ::xla::ComputeCapability* release_cc();
644
+ ::xla::ComputeCapability* mutable_cc();
645
+ void set_allocated_cc(::xla::ComputeCapability* cc);
646
+ private:
647
+ const ::xla::ComputeCapability& _internal_cc() const;
648
+ ::xla::ComputeCapability* _internal_mutable_cc();
649
+ public:
650
+ void unsafe_arena_set_allocated_cc(
651
+ ::xla::ComputeCapability* cc);
652
+ ::xla::ComputeCapability* unsafe_arena_release_cc();
653
+
654
+ // .xla.CudnnVersion cudnn_version = 3;
655
+ bool has_cudnn_version() const;
656
+ private:
657
+ bool _internal_has_cudnn_version() const;
658
+ public:
659
+ void clear_cudnn_version();
660
+ const ::xla::CudnnVersion& cudnn_version() const;
661
+ PROTOBUF_NODISCARD ::xla::CudnnVersion* release_cudnn_version();
662
+ ::xla::CudnnVersion* mutable_cudnn_version();
663
+ void set_allocated_cudnn_version(::xla::CudnnVersion* cudnn_version);
664
+ private:
665
+ const ::xla::CudnnVersion& _internal_cudnn_version() const;
666
+ ::xla::CudnnVersion* _internal_mutable_cudnn_version();
667
+ public:
668
+ void unsafe_arena_set_allocated_cudnn_version(
669
+ ::xla::CudnnVersion* cudnn_version);
670
+ ::xla::CudnnVersion* unsafe_arena_release_cudnn_version();
671
+
672
+ // @@protoc_insertion_point(class_scope:xla.gpu.AlgorithmDenylistEntry)
673
+ private:
674
+ class _Internal;
675
+
676
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
677
+ typedef void InternalArenaConstructable_;
678
+ typedef void DestructorSkippable_;
679
+ struct Impl_ {
680
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::DenylistedAlgorithm > algos_;
681
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr hlo_;
682
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr blas_version_;
683
+ ::xla::ComputeCapability* cc_;
684
+ ::xla::CudnnVersion* cudnn_version_;
685
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
686
+ };
687
+ union { Impl_ _impl_; };
688
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto;
689
+ };
690
+ // -------------------------------------------------------------------
691
+
692
+ class AlgorithmDenylist final :
693
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.gpu.AlgorithmDenylist) */ {
694
+ public:
695
+ inline AlgorithmDenylist() : AlgorithmDenylist(nullptr) {}
696
+ ~AlgorithmDenylist() override;
697
+ explicit PROTOBUF_CONSTEXPR AlgorithmDenylist(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
698
+
699
+ AlgorithmDenylist(const AlgorithmDenylist& from);
700
+ AlgorithmDenylist(AlgorithmDenylist&& from) noexcept
701
+ : AlgorithmDenylist() {
702
+ *this = ::std::move(from);
703
+ }
704
+
705
+ inline AlgorithmDenylist& operator=(const AlgorithmDenylist& from) {
706
+ CopyFrom(from);
707
+ return *this;
708
+ }
709
+ inline AlgorithmDenylist& operator=(AlgorithmDenylist&& from) noexcept {
710
+ if (this == &from) return *this;
711
+ if (GetOwningArena() == from.GetOwningArena()
712
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
713
+ && GetOwningArena() != nullptr
714
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
715
+ ) {
716
+ InternalSwap(&from);
717
+ } else {
718
+ CopyFrom(from);
719
+ }
720
+ return *this;
721
+ }
722
+
723
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
724
+ return GetDescriptor();
725
+ }
726
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
727
+ return default_instance().GetMetadata().descriptor;
728
+ }
729
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
730
+ return default_instance().GetMetadata().reflection;
731
+ }
732
+ static const AlgorithmDenylist& default_instance() {
733
+ return *internal_default_instance();
734
+ }
735
+ static inline const AlgorithmDenylist* internal_default_instance() {
736
+ return reinterpret_cast<const AlgorithmDenylist*>(
737
+ &_AlgorithmDenylist_default_instance_);
738
+ }
739
+ static constexpr int kIndexInFileMessages =
740
+ 3;
741
+
742
+ friend void swap(AlgorithmDenylist& a, AlgorithmDenylist& b) {
743
+ a.Swap(&b);
744
+ }
745
+ inline void Swap(AlgorithmDenylist* other) {
746
+ if (other == this) return;
747
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
748
+ if (GetOwningArena() != nullptr &&
749
+ GetOwningArena() == other->GetOwningArena()) {
750
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
751
+ if (GetOwningArena() == other->GetOwningArena()) {
752
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
753
+ InternalSwap(other);
754
+ } else {
755
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
756
+ }
757
+ }
758
+ void UnsafeArenaSwap(AlgorithmDenylist* other) {
759
+ if (other == this) return;
760
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
761
+ InternalSwap(other);
762
+ }
763
+
764
+ // implements Message ----------------------------------------------
765
+
766
+ AlgorithmDenylist* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
767
+ return CreateMaybeMessage<AlgorithmDenylist>(arena);
768
+ }
769
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
770
+ void CopyFrom(const AlgorithmDenylist& from);
771
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
772
+ void MergeFrom( const AlgorithmDenylist& from) {
773
+ AlgorithmDenylist::MergeImpl(*this, from);
774
+ }
775
+ private:
776
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
777
+ public:
778
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
779
+ bool IsInitialized() const final;
780
+
781
+ size_t ByteSizeLong() const final;
782
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
783
+ uint8_t* _InternalSerialize(
784
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
785
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
786
+
787
+ private:
788
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
789
+ void SharedDtor();
790
+ void SetCachedSize(int size) const final;
791
+ void InternalSwap(AlgorithmDenylist* other);
792
+
793
+ private:
794
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
795
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
796
+ return "xla.gpu.AlgorithmDenylist";
797
+ }
798
+ protected:
799
+ explicit AlgorithmDenylist(::PROTOBUF_NAMESPACE_ID::Arena* arena,
800
+ bool is_message_owned = false);
801
+ public:
802
+
803
+ static const ClassData _class_data_;
804
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
805
+
806
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
807
+
808
+ // nested types ----------------------------------------------------
809
+
810
+ // accessors -------------------------------------------------------
811
+
812
+ enum : int {
813
+ kEntriesFieldNumber = 1,
814
+ };
815
+ // repeated .xla.gpu.AlgorithmDenylistEntry entries = 1;
816
+ int entries_size() const;
817
+ private:
818
+ int _internal_entries_size() const;
819
+ public:
820
+ void clear_entries();
821
+ ::xla::gpu::AlgorithmDenylistEntry* mutable_entries(int index);
822
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::AlgorithmDenylistEntry >*
823
+ mutable_entries();
824
+ private:
825
+ const ::xla::gpu::AlgorithmDenylistEntry& _internal_entries(int index) const;
826
+ ::xla::gpu::AlgorithmDenylistEntry* _internal_add_entries();
827
+ public:
828
+ const ::xla::gpu::AlgorithmDenylistEntry& entries(int index) const;
829
+ ::xla::gpu::AlgorithmDenylistEntry* add_entries();
830
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::AlgorithmDenylistEntry >&
831
+ entries() const;
832
+
833
+ // @@protoc_insertion_point(class_scope:xla.gpu.AlgorithmDenylist)
834
+ private:
835
+ class _Internal;
836
+
837
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
838
+ typedef void InternalArenaConstructable_;
839
+ typedef void DestructorSkippable_;
840
+ struct Impl_ {
841
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::AlgorithmDenylistEntry > entries_;
842
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
843
+ };
844
+ union { Impl_ _impl_; };
845
+ friend struct ::TableStruct_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto;
846
+ };
847
+ // ===================================================================
848
+
849
+
850
+ // ===================================================================
851
+
852
+ #ifdef __GNUC__
853
+ #pragma GCC diagnostic push
854
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
855
+ #endif // __GNUC__
856
+ // ConvInstructionLog
857
+
858
+ // .xla.HloInstructionProto instruction = 1;
859
+ inline bool ConvInstructionLog::_internal_has_instruction() const {
860
+ return this != internal_default_instance() && _impl_.instruction_ != nullptr;
861
+ }
862
+ inline bool ConvInstructionLog::has_instruction() const {
863
+ return _internal_has_instruction();
864
+ }
865
+ inline const ::xla::HloInstructionProto& ConvInstructionLog::_internal_instruction() const {
866
+ const ::xla::HloInstructionProto* p = _impl_.instruction_;
867
+ return p != nullptr ? *p : reinterpret_cast<const ::xla::HloInstructionProto&>(
868
+ ::xla::_HloInstructionProto_default_instance_);
869
+ }
870
+ inline const ::xla::HloInstructionProto& ConvInstructionLog::instruction() const {
871
+ // @@protoc_insertion_point(field_get:xla.gpu.ConvInstructionLog.instruction)
872
+ return _internal_instruction();
873
+ }
874
+ inline void ConvInstructionLog::unsafe_arena_set_allocated_instruction(
875
+ ::xla::HloInstructionProto* instruction) {
876
+ if (GetArenaForAllocation() == nullptr) {
877
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.instruction_);
878
+ }
879
+ _impl_.instruction_ = instruction;
880
+ if (instruction) {
881
+
882
+ } else {
883
+
884
+ }
885
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.gpu.ConvInstructionLog.instruction)
886
+ }
887
+ inline ::xla::HloInstructionProto* ConvInstructionLog::release_instruction() {
888
+
889
+ ::xla::HloInstructionProto* temp = _impl_.instruction_;
890
+ _impl_.instruction_ = nullptr;
891
+ #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
892
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
893
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
894
+ if (GetArenaForAllocation() == nullptr) { delete old; }
895
+ #else // PROTOBUF_FORCE_COPY_IN_RELEASE
896
+ if (GetArenaForAllocation() != nullptr) {
897
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
898
+ }
899
+ #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
900
+ return temp;
901
+ }
902
+ inline ::xla::HloInstructionProto* ConvInstructionLog::unsafe_arena_release_instruction() {
903
+ // @@protoc_insertion_point(field_release:xla.gpu.ConvInstructionLog.instruction)
904
+
905
+ ::xla::HloInstructionProto* temp = _impl_.instruction_;
906
+ _impl_.instruction_ = nullptr;
907
+ return temp;
908
+ }
909
+ inline ::xla::HloInstructionProto* ConvInstructionLog::_internal_mutable_instruction() {
910
+
911
+ if (_impl_.instruction_ == nullptr) {
912
+ auto* p = CreateMaybeMessage<::xla::HloInstructionProto>(GetArenaForAllocation());
913
+ _impl_.instruction_ = p;
914
+ }
915
+ return _impl_.instruction_;
916
+ }
917
+ inline ::xla::HloInstructionProto* ConvInstructionLog::mutable_instruction() {
918
+ ::xla::HloInstructionProto* _msg = _internal_mutable_instruction();
919
+ // @@protoc_insertion_point(field_mutable:xla.gpu.ConvInstructionLog.instruction)
920
+ return _msg;
921
+ }
922
+ inline void ConvInstructionLog::set_allocated_instruction(::xla::HloInstructionProto* instruction) {
923
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
924
+ if (message_arena == nullptr) {
925
+ delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.instruction_);
926
+ }
927
+ if (instruction) {
928
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
929
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
930
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(instruction));
931
+ if (message_arena != submessage_arena) {
932
+ instruction = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
933
+ message_arena, instruction, submessage_arena);
934
+ }
935
+
936
+ } else {
937
+
938
+ }
939
+ _impl_.instruction_ = instruction;
940
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.ConvInstructionLog.instruction)
941
+ }
942
+
943
+ // repeated .xla.ShapeProto operand_shapes = 2;
944
+ inline int ConvInstructionLog::_internal_operand_shapes_size() const {
945
+ return _impl_.operand_shapes_.size();
946
+ }
947
+ inline int ConvInstructionLog::operand_shapes_size() const {
948
+ return _internal_operand_shapes_size();
949
+ }
950
+ inline ::xla::ShapeProto* ConvInstructionLog::mutable_operand_shapes(int index) {
951
+ // @@protoc_insertion_point(field_mutable:xla.gpu.ConvInstructionLog.operand_shapes)
952
+ return _impl_.operand_shapes_.Mutable(index);
953
+ }
954
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::ShapeProto >*
955
+ ConvInstructionLog::mutable_operand_shapes() {
956
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.ConvInstructionLog.operand_shapes)
957
+ return &_impl_.operand_shapes_;
958
+ }
959
+ inline const ::xla::ShapeProto& ConvInstructionLog::_internal_operand_shapes(int index) const {
960
+ return _impl_.operand_shapes_.Get(index);
961
+ }
962
+ inline const ::xla::ShapeProto& ConvInstructionLog::operand_shapes(int index) const {
963
+ // @@protoc_insertion_point(field_get:xla.gpu.ConvInstructionLog.operand_shapes)
964
+ return _internal_operand_shapes(index);
965
+ }
966
+ inline ::xla::ShapeProto* ConvInstructionLog::_internal_add_operand_shapes() {
967
+ return _impl_.operand_shapes_.Add();
968
+ }
969
+ inline ::xla::ShapeProto* ConvInstructionLog::add_operand_shapes() {
970
+ ::xla::ShapeProto* _add = _internal_add_operand_shapes();
971
+ // @@protoc_insertion_point(field_add:xla.gpu.ConvInstructionLog.operand_shapes)
972
+ return _add;
973
+ }
974
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::ShapeProto >&
975
+ ConvInstructionLog::operand_shapes() const {
976
+ // @@protoc_insertion_point(field_list:xla.gpu.ConvInstructionLog.operand_shapes)
977
+ return _impl_.operand_shapes_;
978
+ }
979
+
980
+ // repeated uint64 result_addresses = 3;
981
+ inline int ConvInstructionLog::_internal_result_addresses_size() const {
982
+ return _impl_.result_addresses_.size();
983
+ }
984
+ inline int ConvInstructionLog::result_addresses_size() const {
985
+ return _internal_result_addresses_size();
986
+ }
987
+ inline void ConvInstructionLog::clear_result_addresses() {
988
+ _impl_.result_addresses_.Clear();
989
+ }
990
+ inline uint64_t ConvInstructionLog::_internal_result_addresses(int index) const {
991
+ return _impl_.result_addresses_.Get(index);
992
+ }
993
+ inline uint64_t ConvInstructionLog::result_addresses(int index) const {
994
+ // @@protoc_insertion_point(field_get:xla.gpu.ConvInstructionLog.result_addresses)
995
+ return _internal_result_addresses(index);
996
+ }
997
+ inline void ConvInstructionLog::set_result_addresses(int index, uint64_t value) {
998
+ _impl_.result_addresses_.Set(index, value);
999
+ // @@protoc_insertion_point(field_set:xla.gpu.ConvInstructionLog.result_addresses)
1000
+ }
1001
+ inline void ConvInstructionLog::_internal_add_result_addresses(uint64_t value) {
1002
+ _impl_.result_addresses_.Add(value);
1003
+ }
1004
+ inline void ConvInstructionLog::add_result_addresses(uint64_t value) {
1005
+ _internal_add_result_addresses(value);
1006
+ // @@protoc_insertion_point(field_add:xla.gpu.ConvInstructionLog.result_addresses)
1007
+ }
1008
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
1009
+ ConvInstructionLog::_internal_result_addresses() const {
1010
+ return _impl_.result_addresses_;
1011
+ }
1012
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
1013
+ ConvInstructionLog::result_addresses() const {
1014
+ // @@protoc_insertion_point(field_list:xla.gpu.ConvInstructionLog.result_addresses)
1015
+ return _internal_result_addresses();
1016
+ }
1017
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
1018
+ ConvInstructionLog::_internal_mutable_result_addresses() {
1019
+ return &_impl_.result_addresses_;
1020
+ }
1021
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
1022
+ ConvInstructionLog::mutable_result_addresses() {
1023
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.ConvInstructionLog.result_addresses)
1024
+ return _internal_mutable_result_addresses();
1025
+ }
1026
+
1027
+ // repeated uint64 operand_addresses = 4;
1028
+ inline int ConvInstructionLog::_internal_operand_addresses_size() const {
1029
+ return _impl_.operand_addresses_.size();
1030
+ }
1031
+ inline int ConvInstructionLog::operand_addresses_size() const {
1032
+ return _internal_operand_addresses_size();
1033
+ }
1034
+ inline void ConvInstructionLog::clear_operand_addresses() {
1035
+ _impl_.operand_addresses_.Clear();
1036
+ }
1037
+ inline uint64_t ConvInstructionLog::_internal_operand_addresses(int index) const {
1038
+ return _impl_.operand_addresses_.Get(index);
1039
+ }
1040
+ inline uint64_t ConvInstructionLog::operand_addresses(int index) const {
1041
+ // @@protoc_insertion_point(field_get:xla.gpu.ConvInstructionLog.operand_addresses)
1042
+ return _internal_operand_addresses(index);
1043
+ }
1044
+ inline void ConvInstructionLog::set_operand_addresses(int index, uint64_t value) {
1045
+ _impl_.operand_addresses_.Set(index, value);
1046
+ // @@protoc_insertion_point(field_set:xla.gpu.ConvInstructionLog.operand_addresses)
1047
+ }
1048
+ inline void ConvInstructionLog::_internal_add_operand_addresses(uint64_t value) {
1049
+ _impl_.operand_addresses_.Add(value);
1050
+ }
1051
+ inline void ConvInstructionLog::add_operand_addresses(uint64_t value) {
1052
+ _internal_add_operand_addresses(value);
1053
+ // @@protoc_insertion_point(field_add:xla.gpu.ConvInstructionLog.operand_addresses)
1054
+ }
1055
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
1056
+ ConvInstructionLog::_internal_operand_addresses() const {
1057
+ return _impl_.operand_addresses_;
1058
+ }
1059
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >&
1060
+ ConvInstructionLog::operand_addresses() const {
1061
+ // @@protoc_insertion_point(field_list:xla.gpu.ConvInstructionLog.operand_addresses)
1062
+ return _internal_operand_addresses();
1063
+ }
1064
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
1065
+ ConvInstructionLog::_internal_mutable_operand_addresses() {
1066
+ return &_impl_.operand_addresses_;
1067
+ }
1068
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >*
1069
+ ConvInstructionLog::mutable_operand_addresses() {
1070
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.ConvInstructionLog.operand_addresses)
1071
+ return _internal_mutable_operand_addresses();
1072
+ }
1073
+
1074
+ // -------------------------------------------------------------------
1075
+
1076
+ // DenylistedAlgorithm
1077
+
1078
+ // int64 id = 1;
1079
+ inline void DenylistedAlgorithm::clear_id() {
1080
+ _impl_.id_ = int64_t{0};
1081
+ }
1082
+ inline int64_t DenylistedAlgorithm::_internal_id() const {
1083
+ return _impl_.id_;
1084
+ }
1085
+ inline int64_t DenylistedAlgorithm::id() const {
1086
+ // @@protoc_insertion_point(field_get:xla.gpu.DenylistedAlgorithm.id)
1087
+ return _internal_id();
1088
+ }
1089
+ inline void DenylistedAlgorithm::_internal_set_id(int64_t value) {
1090
+
1091
+ _impl_.id_ = value;
1092
+ }
1093
+ inline void DenylistedAlgorithm::set_id(int64_t value) {
1094
+ _internal_set_id(value);
1095
+ // @@protoc_insertion_point(field_set:xla.gpu.DenylistedAlgorithm.id)
1096
+ }
1097
+
1098
+ // bool tensor_ops = 2;
1099
+ inline void DenylistedAlgorithm::clear_tensor_ops() {
1100
+ _impl_.tensor_ops_ = false;
1101
+ }
1102
+ inline bool DenylistedAlgorithm::_internal_tensor_ops() const {
1103
+ return _impl_.tensor_ops_;
1104
+ }
1105
+ inline bool DenylistedAlgorithm::tensor_ops() const {
1106
+ // @@protoc_insertion_point(field_get:xla.gpu.DenylistedAlgorithm.tensor_ops)
1107
+ return _internal_tensor_ops();
1108
+ }
1109
+ inline void DenylistedAlgorithm::_internal_set_tensor_ops(bool value) {
1110
+
1111
+ _impl_.tensor_ops_ = value;
1112
+ }
1113
+ inline void DenylistedAlgorithm::set_tensor_ops(bool value) {
1114
+ _internal_set_tensor_ops(value);
1115
+ // @@protoc_insertion_point(field_set:xla.gpu.DenylistedAlgorithm.tensor_ops)
1116
+ }
1117
+
1118
+ // -------------------------------------------------------------------
1119
+
1120
+ // AlgorithmDenylistEntry
1121
+
1122
+ // string hlo = 1;
1123
+ inline void AlgorithmDenylistEntry::clear_hlo() {
1124
+ _impl_.hlo_.ClearToEmpty();
1125
+ }
1126
+ inline const std::string& AlgorithmDenylistEntry::hlo() const {
1127
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylistEntry.hlo)
1128
+ return _internal_hlo();
1129
+ }
1130
+ template <typename ArgT0, typename... ArgT>
1131
+ inline PROTOBUF_ALWAYS_INLINE
1132
+ void AlgorithmDenylistEntry::set_hlo(ArgT0&& arg0, ArgT... args) {
1133
+
1134
+ _impl_.hlo_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
1135
+ // @@protoc_insertion_point(field_set:xla.gpu.AlgorithmDenylistEntry.hlo)
1136
+ }
1137
+ inline std::string* AlgorithmDenylistEntry::mutable_hlo() {
1138
+ std::string* _s = _internal_mutable_hlo();
1139
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylistEntry.hlo)
1140
+ return _s;
1141
+ }
1142
+ inline const std::string& AlgorithmDenylistEntry::_internal_hlo() const {
1143
+ return _impl_.hlo_.Get();
1144
+ }
1145
+ inline void AlgorithmDenylistEntry::_internal_set_hlo(const std::string& value) {
1146
+
1147
+ _impl_.hlo_.Set(value, GetArenaForAllocation());
1148
+ }
1149
+ inline std::string* AlgorithmDenylistEntry::_internal_mutable_hlo() {
1150
+
1151
+ return _impl_.hlo_.Mutable(GetArenaForAllocation());
1152
+ }
1153
+ inline std::string* AlgorithmDenylistEntry::release_hlo() {
1154
+ // @@protoc_insertion_point(field_release:xla.gpu.AlgorithmDenylistEntry.hlo)
1155
+ return _impl_.hlo_.Release();
1156
+ }
1157
+ inline void AlgorithmDenylistEntry::set_allocated_hlo(std::string* hlo) {
1158
+ if (hlo != nullptr) {
1159
+
1160
+ } else {
1161
+
1162
+ }
1163
+ _impl_.hlo_.SetAllocated(hlo, GetArenaForAllocation());
1164
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
1165
+ if (_impl_.hlo_.IsDefault()) {
1166
+ _impl_.hlo_.Set("", GetArenaForAllocation());
1167
+ }
1168
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
1169
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.AlgorithmDenylistEntry.hlo)
1170
+ }
1171
+
1172
+ // .xla.ComputeCapability cc = 2;
1173
+ inline bool AlgorithmDenylistEntry::_internal_has_cc() const {
1174
+ return this != internal_default_instance() && _impl_.cc_ != nullptr;
1175
+ }
1176
+ inline bool AlgorithmDenylistEntry::has_cc() const {
1177
+ return _internal_has_cc();
1178
+ }
1179
+ inline const ::xla::ComputeCapability& AlgorithmDenylistEntry::_internal_cc() const {
1180
+ const ::xla::ComputeCapability* p = _impl_.cc_;
1181
+ return p != nullptr ? *p : reinterpret_cast<const ::xla::ComputeCapability&>(
1182
+ ::xla::_ComputeCapability_default_instance_);
1183
+ }
1184
+ inline const ::xla::ComputeCapability& AlgorithmDenylistEntry::cc() const {
1185
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylistEntry.cc)
1186
+ return _internal_cc();
1187
+ }
1188
+ inline void AlgorithmDenylistEntry::unsafe_arena_set_allocated_cc(
1189
+ ::xla::ComputeCapability* cc) {
1190
+ if (GetArenaForAllocation() == nullptr) {
1191
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cc_);
1192
+ }
1193
+ _impl_.cc_ = cc;
1194
+ if (cc) {
1195
+
1196
+ } else {
1197
+
1198
+ }
1199
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.gpu.AlgorithmDenylistEntry.cc)
1200
+ }
1201
+ inline ::xla::ComputeCapability* AlgorithmDenylistEntry::release_cc() {
1202
+
1203
+ ::xla::ComputeCapability* temp = _impl_.cc_;
1204
+ _impl_.cc_ = nullptr;
1205
+ #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
1206
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
1207
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
1208
+ if (GetArenaForAllocation() == nullptr) { delete old; }
1209
+ #else // PROTOBUF_FORCE_COPY_IN_RELEASE
1210
+ if (GetArenaForAllocation() != nullptr) {
1211
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
1212
+ }
1213
+ #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
1214
+ return temp;
1215
+ }
1216
+ inline ::xla::ComputeCapability* AlgorithmDenylistEntry::unsafe_arena_release_cc() {
1217
+ // @@protoc_insertion_point(field_release:xla.gpu.AlgorithmDenylistEntry.cc)
1218
+
1219
+ ::xla::ComputeCapability* temp = _impl_.cc_;
1220
+ _impl_.cc_ = nullptr;
1221
+ return temp;
1222
+ }
1223
+ inline ::xla::ComputeCapability* AlgorithmDenylistEntry::_internal_mutable_cc() {
1224
+
1225
+ if (_impl_.cc_ == nullptr) {
1226
+ auto* p = CreateMaybeMessage<::xla::ComputeCapability>(GetArenaForAllocation());
1227
+ _impl_.cc_ = p;
1228
+ }
1229
+ return _impl_.cc_;
1230
+ }
1231
+ inline ::xla::ComputeCapability* AlgorithmDenylistEntry::mutable_cc() {
1232
+ ::xla::ComputeCapability* _msg = _internal_mutable_cc();
1233
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylistEntry.cc)
1234
+ return _msg;
1235
+ }
1236
+ inline void AlgorithmDenylistEntry::set_allocated_cc(::xla::ComputeCapability* cc) {
1237
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
1238
+ if (message_arena == nullptr) {
1239
+ delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cc_);
1240
+ }
1241
+ if (cc) {
1242
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
1243
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
1244
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(cc));
1245
+ if (message_arena != submessage_arena) {
1246
+ cc = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
1247
+ message_arena, cc, submessage_arena);
1248
+ }
1249
+
1250
+ } else {
1251
+
1252
+ }
1253
+ _impl_.cc_ = cc;
1254
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.AlgorithmDenylistEntry.cc)
1255
+ }
1256
+
1257
+ // .xla.CudnnVersion cudnn_version = 3;
1258
+ inline bool AlgorithmDenylistEntry::_internal_has_cudnn_version() const {
1259
+ return this != internal_default_instance() && _impl_.cudnn_version_ != nullptr;
1260
+ }
1261
+ inline bool AlgorithmDenylistEntry::has_cudnn_version() const {
1262
+ return _internal_has_cudnn_version();
1263
+ }
1264
+ inline const ::xla::CudnnVersion& AlgorithmDenylistEntry::_internal_cudnn_version() const {
1265
+ const ::xla::CudnnVersion* p = _impl_.cudnn_version_;
1266
+ return p != nullptr ? *p : reinterpret_cast<const ::xla::CudnnVersion&>(
1267
+ ::xla::_CudnnVersion_default_instance_);
1268
+ }
1269
+ inline const ::xla::CudnnVersion& AlgorithmDenylistEntry::cudnn_version() const {
1270
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylistEntry.cudnn_version)
1271
+ return _internal_cudnn_version();
1272
+ }
1273
+ inline void AlgorithmDenylistEntry::unsafe_arena_set_allocated_cudnn_version(
1274
+ ::xla::CudnnVersion* cudnn_version) {
1275
+ if (GetArenaForAllocation() == nullptr) {
1276
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cudnn_version_);
1277
+ }
1278
+ _impl_.cudnn_version_ = cudnn_version;
1279
+ if (cudnn_version) {
1280
+
1281
+ } else {
1282
+
1283
+ }
1284
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.gpu.AlgorithmDenylistEntry.cudnn_version)
1285
+ }
1286
+ inline ::xla::CudnnVersion* AlgorithmDenylistEntry::release_cudnn_version() {
1287
+
1288
+ ::xla::CudnnVersion* temp = _impl_.cudnn_version_;
1289
+ _impl_.cudnn_version_ = nullptr;
1290
+ #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
1291
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
1292
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
1293
+ if (GetArenaForAllocation() == nullptr) { delete old; }
1294
+ #else // PROTOBUF_FORCE_COPY_IN_RELEASE
1295
+ if (GetArenaForAllocation() != nullptr) {
1296
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
1297
+ }
1298
+ #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
1299
+ return temp;
1300
+ }
1301
+ inline ::xla::CudnnVersion* AlgorithmDenylistEntry::unsafe_arena_release_cudnn_version() {
1302
+ // @@protoc_insertion_point(field_release:xla.gpu.AlgorithmDenylistEntry.cudnn_version)
1303
+
1304
+ ::xla::CudnnVersion* temp = _impl_.cudnn_version_;
1305
+ _impl_.cudnn_version_ = nullptr;
1306
+ return temp;
1307
+ }
1308
+ inline ::xla::CudnnVersion* AlgorithmDenylistEntry::_internal_mutable_cudnn_version() {
1309
+
1310
+ if (_impl_.cudnn_version_ == nullptr) {
1311
+ auto* p = CreateMaybeMessage<::xla::CudnnVersion>(GetArenaForAllocation());
1312
+ _impl_.cudnn_version_ = p;
1313
+ }
1314
+ return _impl_.cudnn_version_;
1315
+ }
1316
+ inline ::xla::CudnnVersion* AlgorithmDenylistEntry::mutable_cudnn_version() {
1317
+ ::xla::CudnnVersion* _msg = _internal_mutable_cudnn_version();
1318
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylistEntry.cudnn_version)
1319
+ return _msg;
1320
+ }
1321
+ inline void AlgorithmDenylistEntry::set_allocated_cudnn_version(::xla::CudnnVersion* cudnn_version) {
1322
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
1323
+ if (message_arena == nullptr) {
1324
+ delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cudnn_version_);
1325
+ }
1326
+ if (cudnn_version) {
1327
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
1328
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
1329
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(cudnn_version));
1330
+ if (message_arena != submessage_arena) {
1331
+ cudnn_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
1332
+ message_arena, cudnn_version, submessage_arena);
1333
+ }
1334
+
1335
+ } else {
1336
+
1337
+ }
1338
+ _impl_.cudnn_version_ = cudnn_version;
1339
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.AlgorithmDenylistEntry.cudnn_version)
1340
+ }
1341
+
1342
+ // string blas_version = 5;
1343
+ inline void AlgorithmDenylistEntry::clear_blas_version() {
1344
+ _impl_.blas_version_.ClearToEmpty();
1345
+ }
1346
+ inline const std::string& AlgorithmDenylistEntry::blas_version() const {
1347
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylistEntry.blas_version)
1348
+ return _internal_blas_version();
1349
+ }
1350
+ template <typename ArgT0, typename... ArgT>
1351
+ inline PROTOBUF_ALWAYS_INLINE
1352
+ void AlgorithmDenylistEntry::set_blas_version(ArgT0&& arg0, ArgT... args) {
1353
+
1354
+ _impl_.blas_version_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
1355
+ // @@protoc_insertion_point(field_set:xla.gpu.AlgorithmDenylistEntry.blas_version)
1356
+ }
1357
+ inline std::string* AlgorithmDenylistEntry::mutable_blas_version() {
1358
+ std::string* _s = _internal_mutable_blas_version();
1359
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylistEntry.blas_version)
1360
+ return _s;
1361
+ }
1362
+ inline const std::string& AlgorithmDenylistEntry::_internal_blas_version() const {
1363
+ return _impl_.blas_version_.Get();
1364
+ }
1365
+ inline void AlgorithmDenylistEntry::_internal_set_blas_version(const std::string& value) {
1366
+
1367
+ _impl_.blas_version_.Set(value, GetArenaForAllocation());
1368
+ }
1369
+ inline std::string* AlgorithmDenylistEntry::_internal_mutable_blas_version() {
1370
+
1371
+ return _impl_.blas_version_.Mutable(GetArenaForAllocation());
1372
+ }
1373
+ inline std::string* AlgorithmDenylistEntry::release_blas_version() {
1374
+ // @@protoc_insertion_point(field_release:xla.gpu.AlgorithmDenylistEntry.blas_version)
1375
+ return _impl_.blas_version_.Release();
1376
+ }
1377
+ inline void AlgorithmDenylistEntry::set_allocated_blas_version(std::string* blas_version) {
1378
+ if (blas_version != nullptr) {
1379
+
1380
+ } else {
1381
+
1382
+ }
1383
+ _impl_.blas_version_.SetAllocated(blas_version, GetArenaForAllocation());
1384
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
1385
+ if (_impl_.blas_version_.IsDefault()) {
1386
+ _impl_.blas_version_.Set("", GetArenaForAllocation());
1387
+ }
1388
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
1389
+ // @@protoc_insertion_point(field_set_allocated:xla.gpu.AlgorithmDenylistEntry.blas_version)
1390
+ }
1391
+
1392
+ // repeated .xla.gpu.DenylistedAlgorithm algos = 4;
1393
+ inline int AlgorithmDenylistEntry::_internal_algos_size() const {
1394
+ return _impl_.algos_.size();
1395
+ }
1396
+ inline int AlgorithmDenylistEntry::algos_size() const {
1397
+ return _internal_algos_size();
1398
+ }
1399
+ inline void AlgorithmDenylistEntry::clear_algos() {
1400
+ _impl_.algos_.Clear();
1401
+ }
1402
+ inline ::xla::gpu::DenylistedAlgorithm* AlgorithmDenylistEntry::mutable_algos(int index) {
1403
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylistEntry.algos)
1404
+ return _impl_.algos_.Mutable(index);
1405
+ }
1406
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::DenylistedAlgorithm >*
1407
+ AlgorithmDenylistEntry::mutable_algos() {
1408
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.AlgorithmDenylistEntry.algos)
1409
+ return &_impl_.algos_;
1410
+ }
1411
+ inline const ::xla::gpu::DenylistedAlgorithm& AlgorithmDenylistEntry::_internal_algos(int index) const {
1412
+ return _impl_.algos_.Get(index);
1413
+ }
1414
+ inline const ::xla::gpu::DenylistedAlgorithm& AlgorithmDenylistEntry::algos(int index) const {
1415
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylistEntry.algos)
1416
+ return _internal_algos(index);
1417
+ }
1418
+ inline ::xla::gpu::DenylistedAlgorithm* AlgorithmDenylistEntry::_internal_add_algos() {
1419
+ return _impl_.algos_.Add();
1420
+ }
1421
+ inline ::xla::gpu::DenylistedAlgorithm* AlgorithmDenylistEntry::add_algos() {
1422
+ ::xla::gpu::DenylistedAlgorithm* _add = _internal_add_algos();
1423
+ // @@protoc_insertion_point(field_add:xla.gpu.AlgorithmDenylistEntry.algos)
1424
+ return _add;
1425
+ }
1426
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::DenylistedAlgorithm >&
1427
+ AlgorithmDenylistEntry::algos() const {
1428
+ // @@protoc_insertion_point(field_list:xla.gpu.AlgorithmDenylistEntry.algos)
1429
+ return _impl_.algos_;
1430
+ }
1431
+
1432
+ // -------------------------------------------------------------------
1433
+
1434
+ // AlgorithmDenylist
1435
+
1436
+ // repeated .xla.gpu.AlgorithmDenylistEntry entries = 1;
1437
+ inline int AlgorithmDenylist::_internal_entries_size() const {
1438
+ return _impl_.entries_.size();
1439
+ }
1440
+ inline int AlgorithmDenylist::entries_size() const {
1441
+ return _internal_entries_size();
1442
+ }
1443
+ inline void AlgorithmDenylist::clear_entries() {
1444
+ _impl_.entries_.Clear();
1445
+ }
1446
+ inline ::xla::gpu::AlgorithmDenylistEntry* AlgorithmDenylist::mutable_entries(int index) {
1447
+ // @@protoc_insertion_point(field_mutable:xla.gpu.AlgorithmDenylist.entries)
1448
+ return _impl_.entries_.Mutable(index);
1449
+ }
1450
+ inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::AlgorithmDenylistEntry >*
1451
+ AlgorithmDenylist::mutable_entries() {
1452
+ // @@protoc_insertion_point(field_mutable_list:xla.gpu.AlgorithmDenylist.entries)
1453
+ return &_impl_.entries_;
1454
+ }
1455
+ inline const ::xla::gpu::AlgorithmDenylistEntry& AlgorithmDenylist::_internal_entries(int index) const {
1456
+ return _impl_.entries_.Get(index);
1457
+ }
1458
+ inline const ::xla::gpu::AlgorithmDenylistEntry& AlgorithmDenylist::entries(int index) const {
1459
+ // @@protoc_insertion_point(field_get:xla.gpu.AlgorithmDenylist.entries)
1460
+ return _internal_entries(index);
1461
+ }
1462
+ inline ::xla::gpu::AlgorithmDenylistEntry* AlgorithmDenylist::_internal_add_entries() {
1463
+ return _impl_.entries_.Add();
1464
+ }
1465
+ inline ::xla::gpu::AlgorithmDenylistEntry* AlgorithmDenylist::add_entries() {
1466
+ ::xla::gpu::AlgorithmDenylistEntry* _add = _internal_add_entries();
1467
+ // @@protoc_insertion_point(field_add:xla.gpu.AlgorithmDenylist.entries)
1468
+ return _add;
1469
+ }
1470
+ inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::gpu::AlgorithmDenylistEntry >&
1471
+ AlgorithmDenylist::entries() const {
1472
+ // @@protoc_insertion_point(field_list:xla.gpu.AlgorithmDenylist.entries)
1473
+ return _impl_.entries_;
1474
+ }
1475
+
1476
+ #ifdef __GNUC__
1477
+ #pragma GCC diagnostic pop
1478
+ #endif // __GNUC__
1479
+ // -------------------------------------------------------------------
1480
+
1481
+ // -------------------------------------------------------------------
1482
+
1483
+ // -------------------------------------------------------------------
1484
+
1485
+
1486
+ // @@protoc_insertion_point(namespace_scope)
1487
+
1488
+ } // namespace gpu
1489
+ } // namespace xla
1490
+
1491
+ // @@protoc_insertion_point(global_scope)
1492
+
1493
+ #include <google/protobuf/port_undef.inc>
1494
+ #endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_xla_2fservice_2fgpu_2fgpu_5fautotuning_2eproto