Skip to content

Commit

Permalink
[SYCLomatic] Fix malloc memory size bug of math half2 tests. (#732)
Browse files Browse the repository at this point in the history
Signed-off-by: Tang, Jiajun [email protected]
  • Loading branch information
tangjj11 authored Jul 2, 2024
1 parent 2433809 commit 648a17b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions features/feature_case/math/math-emu-half2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ void testHle2(float *const Result, __half2 Input1, __half2 Input2) {

void testHle2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHle2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hle2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -584,7 +584,7 @@ void testHleu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHleu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHleu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hleu2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -606,7 +606,7 @@ void testHlt2(float *const Result, __half2 Input1, __half2 Input2) {

void testHlt2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHlt2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hlt2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -628,7 +628,7 @@ void testHltu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHltu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHltu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hltu2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -650,7 +650,7 @@ void testHne2(float *const Result, __half2 Input1, __half2 Input2) {

void testHne2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHne2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hne2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -672,7 +672,7 @@ void testHneu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHneu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHneu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hneu2", {TestCase.first.first, TestCase.first.second},
Expand Down
12 changes: 6 additions & 6 deletions features/feature_case/math/math-ext-half2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void testHle2(float *const Result, __half2 Input1, __half2 Input2) {

void testHle2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHle2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hle2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -583,7 +583,7 @@ void testHleu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHleu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHleu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hleu2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -605,7 +605,7 @@ void testHlt2(float *const Result, __half2 Input1, __half2 Input2) {

void testHlt2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHlt2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hlt2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -627,7 +627,7 @@ void testHltu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHltu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHltu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hltu2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -649,7 +649,7 @@ void testHne2(float *const Result, __half2 Input1, __half2 Input2) {

void testHne2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHne2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hne2", {TestCase.first.first, TestCase.first.second},
Expand All @@ -671,7 +671,7 @@ void testHneu2(float *const Result, __half2 Input1, __half2 Input2) {

void testHneu2Cases(const vector<pair<half2_pair, h2i_pair>> &TestCases) {
float *Result;
cudaMallocManaged(&Result, sizeof(*Result));
cudaMallocManaged(&Result, 2 * sizeof(*Result));
for (const auto &TestCase : TestCases) {
testHneu2(Result, TestCase.first.first, TestCase.first.second);
checkResult("__hneu2", {TestCase.first.first, TestCase.first.second},
Expand Down

0 comments on commit 648a17b

Please sign in to comment.