Skip to content

Commit

Permalink
[SYCL][ESIMD][E2E] Fix noinline_args tests after pulldown (intel#11327)
Browse files Browse the repository at this point in the history
After the recent pulldown, clang generates llvm.lifetime calls for the
`add` function arguments in different locations causing us to hit a
known optimizable case in ESIMDOptimizeVecArgCallConv so we start
passing the arguments by value. This ends up causing different stack
size, and these tests are very sensitive to stack size.

Add a noop inline assembly statement to prevent the optimization from
kicking in so we preserve by-pointer argument passing in this case.

Closes: intel#11036

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex authored Oct 4, 2023
1 parent ab21ede commit a27c744
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class KernelID;

template <typename TA, typename TB, typename TC>
ESIMD_NOINLINE TC add(TA A, TB B) {
#ifdef __SYCL_DEVICE_ONLY__
// Noop inline asm to prevent arguments being
// optimized to be pass by value as this
// test is very sensitive to stack size.
__asm__("" : : "r"(A.data()), "r"(B.data()));
#endif
return (TC)A + (TC)B;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// XFAIL: gpu && linux
// RUN: %{build} -I%S/.. -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %{run} %t.out

Expand Down

0 comments on commit a27c744

Please sign in to comment.