Skip to content

[SYCL][Bindless] Fix Mipmap Tests #10713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions sycl/test-e2e/bindless_images/mipmap/mipmap_read_1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ int main() {
auto ctxt = q.get_context();

// declare image data
constexpr size_t N = 16;
constexpr size_t N = 15;
std::vector<float> out(N);
std::vector<float> expected(N);
std::vector<sycl::float4> dataIn1(N);
std::vector<sycl::float4> dataIn2(N / 2);
std::vector<sycl::float4> copyOut(N / 2);
int j = 0;

for (int i = 0; i < N; i++) {
expected[i] = i + (j + 10);
if (i % 2)
j++;
// Populate input data (to-be mipmap image layers)
dataIn1[i] = sycl::float4(i, i, i, i);
if (i < (N / 2)) {
dataIn2[i] = sycl::float4(i + 10, i + 10, i + 10, i + 10);
copyOut[i] = sycl::float4{0, 0, 0, 0};
}

// Calculate expected output data
float norm_coord = ((i + 0.5f) / (float)N);
int x = norm_coord * (N >> 1);
expected[i] = dataIn1[i][0] + dataIn2[x][0];
}

try {
Expand Down Expand Up @@ -85,8 +88,8 @@ int main() {
// Extension: read mipmap level 0 with anisotropic filtering and level 1
// with LOD
sycl::float4 px1 =
sycl::ext::oneapi::experimental::read_image<sycl::float4>(
mipHandle, x, 0.0f, 0.0f);
sycl::ext::oneapi::experimental::read_image<sycl::float4>(mipHandle,
x, 0.0f);
sycl::float4 px2 =
sycl::ext::oneapi::experimental::read_image<sycl::float4>(mipHandle,
x, 1.0f);
Expand Down
14 changes: 7 additions & 7 deletions sycl/test-e2e/bindless_images/mipmap/mipmap_read_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ int main() {
}
// Expected each x and y will repeat twice
// since mipmap level 1 is half in size
int jj = 0;
for (int i = 0; i < width - 1; i += 2) {
for (int j = 0; j < height - 1; j += 2, jj++) {
expected[j + (width * i)] = jj;
expected[j + (width * (i + 1))] = jj;
expected[(j + 1) + (width * i)] = jj;
expected[(j + 1) + (width * (i + 1))] = jj;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
float norm_coord_x = ((i + 0.5f) / (float)width);
int x = norm_coord_x * (width >> 1);
float norm_coord_y = ((j + 0.5f) / (float)height);
int y = norm_coord_y * (height >> 1);
expected[j + (width * i)] = dataIn2[y + (width / 2 * x)][0];
}
}

Expand Down
6 changes: 3 additions & 3 deletions sycl/test-e2e/bindless_images/mipmap/mipmap_read_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ int main() {
auto ctxt = q.get_context();

// declare image data
size_t width = 4;
size_t height = 4;
size_t depth = 4;
size_t width = 5;
size_t height = 5;
size_t depth = 5;
size_t N = width * height * depth;
std::vector<float> out(N);
std::vector<float> expected(N);
Expand Down