Skip to content
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

[SYCLomatic #1707] Add test for ldg #633

Open
wants to merge 1 commit into
base: SYCLomatic
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions features/feature_case/ldg/ldg.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "cuda_bf16.h"
#include "cuda_fp16.h"

__global__ void test_ldg_tex_cache_read(int *deviceArray) {
float f1;
double d;
float2 *f2;
__half h1;
__half2 *h2;
uchar4 u4;
ulonglong2 *ull2;

__ldg(&f1);
auto cacheReadD = __ldg(&d);
__ldg(f2);
auto cacheReadH1 = __ldg(&h1);
__ldg(h2);
__ldg(&u4);
__ldg(ull2);
}

int main() {
int test = 0;
test_ldg_tex_cache_read<<<4, 4>>>(&test);
cudaDeviceSynchronize();
return 0;
}
54 changes: 0 additions & 54 deletions features/feature_case/math/math-bf16-conv.cu
Original file line number Diff line number Diff line change
Expand Up @@ -950,46 +950,6 @@ void testLdcvCases(const vector<pair<__nv_bfloat162, int>> &TestCases) {
}
}

__global__ void ldg(float *const Result, __nv_bfloat16 *Input1) {
*Result = __ldg(Input1);
}

void testLdgCases(const vector<pair<__nv_bfloat16, int>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
for (const auto &TestCase : TestCases) {
__nv_bfloat16 *Input;
cudaMallocManaged(&Input, sizeof(*Input));
setValue<<<1, 1>>>(Input, TestCase.first);
cudaDeviceSynchronize();
ldg<<<1, 1>>>(Result, Input);
cudaDeviceSynchronize();
checkResult("__ldg", {TestCase.first}, TestCase.first, *Result,
TestCase.second);
}
}

__global__ void ldg(float *const Result, __nv_bfloat162 *Input1) {
auto ret = __ldg(Input1);
Result[0] = __bfloat162float(ret.x);
Result[1] = __bfloat162float(ret.y);
}

void testLdgCases(const vector<pair<__nv_bfloat162, int>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
__nv_bfloat162 *Input;
cudaMallocManaged(&Input, sizeof(*Input));
setValue<<<1, 1>>>(Input, TestCase.first);
cudaDeviceSynchronize();
ldg<<<1, 1>>>(Result, Input);
cudaDeviceSynchronize();
checkResult("__ldg", {TestCase.first}, TestCase.first,
{Result[0], Result[1]}, TestCase.second);
}
}

__global__ void ldlu(float *const Result, __nv_bfloat16 *Input1) {
*Result = __ldlu(Input1);
}
Expand Down Expand Up @@ -1567,20 +1527,6 @@ int main() {
{{1, 100.6}, 14},
{{100.6, 1}, 14},
});
testLdgCases({
{-0.3, 16},
{-0.4, 16},
{0, 37},
{0.7, 16},
{1, 15},
{100.6, 14},
});
testLdgCases({
{{-0.3, -0.4}, 16},
{{0, 0.7}, 16},
{{1, 100.6}, 14},
{{100.6, 1}, 14},
});
testLdluCases({
{-0.3, 16},
{-0.4, 16},
Expand Down
Loading