File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,13 +223,15 @@ add_subdirectory(src)
223223# ==============================================================================
224224# Examples
225225# ==============================================================================
226- set (INSTALL_GTEST OFF )
227- github_url (GTEST_URL "google/googletest/archive/refs/tags/v1.16.0.tar.gz" )
228- FetchContent_Declare (googletest URL ${GTEST_URL} DOWNLOAD_EXTRACT_TIMESTAMP ON )
229- FetchContent_MakeAvailable (googletest)
230-
231226option (TRITON_JIT_BUILD_EXAMPLES "Build examples" ${PROJECT_IS_TOP_LEVEL} )
232227if (TRITON_JIT_BUILD_EXAMPLES)
228+ # googletest is only needed by the examples; fetch it here so that
229+ # subdirectory consumers (e.g. FlagGems via FetchContent) do not pull it in.
230+ set (INSTALL_GTEST OFF )
231+ github_url (GTEST_URL "google/googletest/archive/refs/tags/v1.16.0.tar.gz" )
232+ FetchContent_Declare (googletest URL ${GTEST_URL} DOWNLOAD_EXTRACT_TIMESTAMP ON )
233+ FetchContent_MakeAvailable (googletest)
234+
233235 add_subdirectory (examples )
234236endif ()
235237
Original file line number Diff line number Diff line change 55#include < optional>
66#include < sstream>
77#include < string>
8+ #include < string_view>
89#include < type_traits>
910#include < unordered_map>
1011#include < utility>
@@ -147,6 +148,16 @@ struct ArgHandle {
147148 // Assumption: nullopt is always treated as constexpr,
148149 // even if the parameter is not marked as constexpr
149150 signature.push_back (" nullopt" );
151+ } else if constexpr (std::is_same_v<std::decay_t <T>, const char *> ||
152+ std::is_same_v<std::decay_t <T>, char *> ||
153+ is_same_ignore_cvref<std::string, T>::value ||
154+ is_same_ignore_cvref<std::string_view, T>::value) {
155+ // A string argument (e.g. a dtype spelled "tl.float32") can only ever be
156+ // a constexpr Triton parameter. Route it to handle_constexpr at compile
157+ // time so the specialized / non-constexpr paths -- which require
158+ // triton_type<T>::name and do not specialize for strings -- are never
159+ // instantiated for a string type.
160+ handle_constexpr (item);
150161 } else {
151162 if (ssig.at (idx) == ArgType::CONSTEXPR ) { // constexpr
152163 handle_constexpr (item);
You can’t perform that action at this time.
0 commit comments