MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / select_ptx_version

Function select_ptx_version

src/runtime/cuda/cuda_queue.cpp:58–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58unsigned select_ptx_version(unsigned sm_version, unsigned& ptx_target) {
59 // Our bitcode libraries need at least ptx +60
60 unsigned ptx_version = 60;
61
62 // for each sm, stores minimum ptx version required
63 // based on data from
64 // https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#ptx-module-directives-target
65 static std::vector<std::array<unsigned, 2>> sm_min_ptx_version =
66 {{72, 61},
67 {75, 63},
68 {80, 70},
69 {86, 71},
70 {87, 74},
71 {88, 90},
72 {89, 78},
73 {90, 80},
74 // some variants of 100, 101 need 8.6, some 8.8
75 // so require 8.8 for all to be on the safe side.
76 {100, 88},
77 {101, 88},
78 {103, 88},
79 {110, 90},
80 {120, 88},
81 {121, 88}};
82
83 if(sm_version < sm_min_ptx_version.front()[0]) {
84 ptx_target = sm_version;
85 return ptx_version;
86 } else if(sm_version >= sm_min_ptx_version.back()[0]) {
87 // in case of newer sm version than we know about,
88 // just try targeting the last known one.
89 ptx_version = sm_min_ptx_version.back()[1];
90 ptx_target = sm_min_ptx_version.back()[0];
91 } else {
92 for(const auto& entry : sm_min_ptx_version) {
93 if(entry[0] >= sm_version) {
94 ptx_version = entry[1];
95 ptx_target = entry[0];
96 break;
97 }
98 }
99 }
100 return ptx_version;
101}
102
103void host_synchronization_callback(cudaStream_t stream, cudaError_t status,
104 void *userData) {

Callers 1

cuda_queueMethod · 0.85

Calls 1

backMethod · 0.80

Tested by

no test coverage detected