CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
158 lines
5.5 KiB
C++
158 lines
5.5 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
|
|
#include "kernels.hh"
|
|
#include "test_fixture.hh"
|
|
|
|
/**
|
|
* @addtogroup tex2DGrad tex2DGrad
|
|
* @{
|
|
* @ingroup TextureTest
|
|
*/
|
|
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Test texture fetching with `tex2DGrad` and read mode set to `hipReadModeElementType`. The
|
|
* test is performed with:
|
|
* - normalized coordinates
|
|
* - non-normalized coordinates
|
|
* - Nearest-point sampling
|
|
* - Linear filtering
|
|
* - All combinations of different addressing modes.
|
|
* Test source
|
|
* ------------------------
|
|
* - unit/texture/tex2DGrad.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 5.7
|
|
*/
|
|
HIP_TEMPLATE_TEST_CASE(Unit_tex2DGrad_Positive_ReadModeElementType, char, unsigned char, short,
|
|
unsigned short, int, unsigned int, float) {
|
|
CHECK_IMAGE_SUPPORT;
|
|
|
|
TextureTestParams<TestType> params = {};
|
|
params.extent = make_hipExtent(16, 4, 0);
|
|
params.num_subdivisions = 4;
|
|
params.GenerateTextureDesc();
|
|
|
|
TextureTestFixture<TestType, false, false> fixture{params};
|
|
|
|
const auto [num_threads_x, num_blocks_x] = GetLaunchConfig(32, params.NumItersX());
|
|
const auto [num_threads_y, num_blocks_y] = GetLaunchConfig(32, params.NumItersY());
|
|
|
|
dim3 dim_grid;
|
|
dim_grid.x = num_blocks_x;
|
|
dim_grid.y = num_blocks_y;
|
|
|
|
dim3 dim_block;
|
|
dim_block.x = num_threads_x;
|
|
dim_block.y = num_threads_y;
|
|
|
|
tex2DGradKernel<vec4<TestType>><<<dim_grid, dim_block>>>(
|
|
fixture.out_alloc_d.ptr(), params.NumItersX(), params.NumItersY(), fixture.tex.object(),
|
|
params.Width(), params.Height(), params.num_subdivisions, params.tex_desc.normalizedCoords,
|
|
float2{0.5f, 0.5f}, float2{0.5f, 0.5f});
|
|
HIP_CHECK(hipGetLastError());
|
|
|
|
fixture.LoadOutput();
|
|
|
|
for (auto i = 0u; i < params.NumItersX() * params.NumItersY(); ++i) {
|
|
float x = i % params.NumItersX();
|
|
float y = i / params.NumItersX();
|
|
|
|
x = GetCoordinate(x, params.NumItersX(), params.Width(), params.num_subdivisions,
|
|
params.tex_desc.normalizedCoords);
|
|
y = GetCoordinate(y, params.NumItersY(), params.Height(), params.num_subdivisions,
|
|
params.tex_desc.normalizedCoords);
|
|
const auto ref_val = fixture.tex_h.Tex2D(x, y, params.tex_desc);
|
|
if (!fixture.Verify(fixture.out_alloc_h[i], ref_val)) {
|
|
INFO("Filtering mode: " << FilteringModeToString(params.tex_desc.filterMode));
|
|
INFO("Normalized coordinates: " << std::boolalpha << params.tex_desc.normalizedCoords);
|
|
INFO("Address mode X: " << AddressModeToString(params.tex_desc.addressMode[0]));
|
|
INFO("Address mode Y: " << AddressModeToString(params.tex_desc.addressMode[1]));
|
|
INFO("x: " << std::fixed << std::setprecision(16) << x);
|
|
INFO("y: " << std::fixed << std::setprecision(16) << y);
|
|
REQUIRE(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Test texture fetching with `tex2DGrad` and read mode set to `hipReadModeNormalizedFloat`.
|
|
* The test is performed with:
|
|
* - normalized coordinates
|
|
* - non-normalized coordinates
|
|
* - Nearest-point sampling
|
|
* - Linear filtering
|
|
* - All combinations of different addressing modes.
|
|
* Test source
|
|
* ------------------------
|
|
* - unit/texture/tex2DGrad.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 5.7
|
|
*/
|
|
HIP_TEMPLATE_TEST_CASE(Unit_tex2DGrad_Positive_ReadModeNormalizedFloat, char, unsigned char,
|
|
short, unsigned short) {
|
|
CHECK_IMAGE_SUPPORT;
|
|
|
|
TextureTestParams<TestType> params = {};
|
|
params.extent = make_hipExtent(16, 4, 0);
|
|
params.num_subdivisions = 4;
|
|
params.GenerateTextureDesc(hipReadModeNormalizedFloat);
|
|
|
|
TextureTestFixture<TestType, true, false> fixture{params};
|
|
|
|
const auto [num_threads_x, num_blocks_x] = GetLaunchConfig(32, params.NumItersX());
|
|
const auto [num_threads_y, num_blocks_y] = GetLaunchConfig(32, params.NumItersY());
|
|
|
|
dim3 dim_grid;
|
|
dim_grid.x = num_blocks_x;
|
|
dim_grid.y = num_blocks_y;
|
|
|
|
dim3 dim_block;
|
|
dim_block.x = num_threads_x;
|
|
dim_block.y = num_threads_y;
|
|
|
|
tex2DGradKernel<vec4<float>><<<dim_grid, dim_block>>>(
|
|
fixture.out_alloc_d.ptr(), params.NumItersX(), params.NumItersY(), fixture.tex.object(),
|
|
params.Width(), params.Height(), params.num_subdivisions, params.tex_desc.normalizedCoords,
|
|
float2{0.5f, 0.5f}, float2{0.5f, 0.5f});
|
|
HIP_CHECK(hipGetLastError());
|
|
|
|
fixture.LoadOutput();
|
|
|
|
for (auto i = 0u; i < params.NumItersX() * params.NumItersY(); ++i) {
|
|
float x = i % params.NumItersX();
|
|
float y = i / params.NumItersX();
|
|
|
|
x = GetCoordinate(x, params.NumItersX(), params.Width(), params.num_subdivisions,
|
|
params.tex_desc.normalizedCoords);
|
|
y = GetCoordinate(y, params.NumItersY(), params.Height(), params.num_subdivisions,
|
|
params.tex_desc.normalizedCoords);
|
|
auto ref_val = fixture.tex_h.Tex2D(x, y, params.tex_desc);
|
|
if (!fixture.Verify(fixture.out_alloc_h[i], ref_val)) {
|
|
INFO("Filtering mode: " << FilteringModeToString(params.tex_desc.filterMode));
|
|
INFO("Normalized coordinates: " << std::boolalpha << params.tex_desc.normalizedCoords);
|
|
INFO("Address mode X: " << AddressModeToString(params.tex_desc.addressMode[0]));
|
|
INFO("Address mode Y: " << AddressModeToString(params.tex_desc.addressMode[1]));
|
|
INFO("x: " << std::fixed << std::setprecision(16) << x);
|
|
INFO("y: " << std::fixed << std::setprecision(16) << y);
|
|
REQUIRE(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* End doxygen group TextureTest.
|
|
* @}
|
|
*/
|