1 /* Copyright 2020 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 TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_ASM_OPTS_H_ 17 #define TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_ASM_OPTS_H_ 18 19 #include <string> 20 #include <tuple> 21 #include <vector> 22 23 #include "absl/strings/string_view.h" 24 #include "absl/types/span.h" 25 26 namespace stream_executor { 27 // Compilation options for compiling ptxas. 28 struct GpuAsmOpts { 29 // Disable Cuda ptxas optimizations. 30 bool disable_gpuasm_optimizations; 31 32 // Cuda directory which would be searched first. 33 std::string preferred_cuda_dir; 34 35 std::vector<std::string> extra_flags; 36 37 explicit GpuAsmOpts(bool disable_gpuasm_optimizations = false, 38 absl::string_view preferred_cuda_dir = "", 39 absl::Span<const std::string> extra_flags = {}) disable_gpuasm_optimizationsGpuAsmOpts40 : disable_gpuasm_optimizations(disable_gpuasm_optimizations), 41 preferred_cuda_dir(preferred_cuda_dir), 42 extra_flags(extra_flags.begin(), extra_flags.end()) {} 43 44 using PtxOptionsTuple = 45 std::tuple<bool, std::string, std::vector<std::string>>; 46 ToTupleGpuAsmOpts47 PtxOptionsTuple ToTuple() { 48 return std::make_tuple(disable_gpuasm_optimizations, preferred_cuda_dir, 49 extra_flags); 50 } 51 }; 52 } // namespace stream_executor 53 54 #endif // TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_ASM_OPTS_H_ 55