Skip to content

Commit

Permalink
Do not compile texture cache functions for gfx94x (#462)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stanleytsang-amd authored Aug 11, 2023
1 parent 1b9a883 commit cca56ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 9 additions & 2 deletions rocprim/include/rocprim/iterator/texture_cache_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <type_traits>

#include "../config.hpp"
#include "../functional.hpp"
#include "../detail/various.hpp"

/// \addtogroup iteratormodule
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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++)
{
Expand All @@ -218,7 +225,7 @@ class texture_cache_iterator
(texture_offset * multiple) + i
);
}

#endif
return *reinterpret_cast<value_type*>(words);
#endif
}
Expand Down
3 changes: 1 addition & 2 deletions test/rocprim/test_texture_cache_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit cca56ad

Please sign in to comment.