From cca56ad007b694048d402c291eede982fb30401d Mon Sep 17 00:00:00 2001 From: Stanley Tsang Date: Fri, 11 Aug 2023 13:08:24 -0600 Subject: [PATCH] Do not compile texture cache functions for gfx94x (#462) * Do not compile texture cache test for gfx94x * Add newline back to EOF * Update documentation to explain texture cache iterator is not supported for gfx94x * Disable/add warnings to texture cache iterator for gfx94x. Remove test warnings * undo comment * Add documentation --- .../rocprim/iterator/texture_cache_iterator.hpp | 11 +++++++++-- test/rocprim/test_texture_cache_iterator.cpp | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rocprim/include/rocprim/iterator/texture_cache_iterator.hpp b/rocprim/include/rocprim/iterator/texture_cache_iterator.hpp index 65e955bb6..e32566be3 100644 --- a/rocprim/include/rocprim/iterator/texture_cache_iterator.hpp +++ b/rocprim/include/rocprim/iterator/texture_cache_iterator.hpp @@ -26,6 +26,7 @@ #include #include "../config.hpp" +#include "../functional.hpp" #include "../detail/various.hpp" /// \addtogroup iteratormodule @@ -111,7 +112,7 @@ struct match_texture_type /// \class texture_cache_iterator /// \brief A random-access input (read-only) iterator adaptor for dereferencing array values -/// through texture cache. +/// through texture cache. This iterator is not functional on gfx94x architectures. /// /// \par Overview /// * A texture_cache_iterator wraps a device pointer of type T, where values are obtained @@ -120,6 +121,8 @@ struct match_texture_type /// * Can only be constructed within host functions, and can only be dereferenced within /// device functions. /// * Accepts any data type from memory, and loads through texture cache. +/// * This iterator is not functional on gfx94x architectures, as native texture fetch functions +/// are not supported in gfx94x. /// /// \tparam T - type of value that can be obtained by dereferencing the iterator. /// \tparam Difference - a type used for identify distance between iterators. @@ -209,6 +212,10 @@ class texture_cache_iterator #else texture_type words[multiple]; + #if defined(__gfx940__) || defined(__gfx941__) || defined(__gfx942__) + #pragma message "Texture cache iterator is not supported on gfx94x as the texture fetch functions in HIP are not available." + ROCPRIM_PRINT_ERROR_ONCE("WARNING: Usage of texture_cache_iterator on gfx94x device is not supported and will not produce valid results.") + #else ROCPRIM_UNROLL for(unsigned int i = 0; i < multiple; i++) { @@ -218,7 +225,7 @@ class texture_cache_iterator (texture_offset * multiple) + i ); } - + #endif return *reinterpret_cast(words); #endif } diff --git a/test/rocprim/test_texture_cache_iterator.cpp b/test/rocprim/test_texture_cache_iterator.cpp index d430cb8c5..62d91abe0 100644 --- a/test/rocprim/test_texture_cache_iterator.cpp +++ b/test/rocprim/test_texture_cache_iterator.cpp @@ -76,8 +76,7 @@ TYPED_TEST(RocprimTextureCacheIteratorTests, Transform) std::string deviceName = std::string(props.gcnArchName); if (deviceName.rfind("gfx94", 0) == 0) { // This is a gfx94x device, so skip this test - SCOPED_TRACE(testing::Message() << "Skipping texture cache text for " << deviceName); - return; + GTEST_SKIP() << "Test not run on gfx94x as texture cache API is not supported"; } HIP_CHECK(hipSetDevice(device_id));