llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[SYCL][ESIMD] Rework -O0 behavior

Open sarnex opened this issue 2 years ago • 3 comments

Let me first say I don't like this change and I wish we didn't have to do this, and it should only be temporary.

The root need is that the IGC VC backend does not support O0 code. It gets miscompiled and produces wrong answers and crashes. The team acknowledges this issue but does not have the resources to fix this at the moment.

From the ESIMD user POV, this is really frustrating. We decided it would be okay if they lost debuggability of device code (but retained it for host code) as long as their program runs and they get the right answer.

So the overall approach is to optimize ESIMD(Not SYCL!!) code even in O0 mode. We are actually already doing this, but this change extends it a bit.

So there are a few main changes in this PR:

  1. Don't pass -O0 to sycl-post-link. Note this option has absolutely no effect on SYCL code today, it is only checked in the ESIMD lowering code in sycl-post-link.
  2. Add a new pass to remove optnone/noinline early for ESIMD code in O0.
  3. Remove optnone/noinline from all functions if we split out ESIMD/SYCL code, and if we don't don't touch it.

All three of these steps are required to fix the tests failing with O0, if we remove any one of them we see many failures.

When running all ESIMD tests with O0, we see the following improvements:

Linux:
Today: 97 failures
With this change: 23 failures, with ~3 root causes. There are no regressions. I'll look into these later.
Windows: 
Today: 38 failures
With this change: 10 failures. There are no regressions. I'll look into these later.

Once IGC VC can actually correctly compile non-optimized code, we should revert this change.

sarnex avatar Feb 05 '24 21:02 sarnex

:white_check_mark: With the latest revision this PR passed the C/C++ code formatter.

github-actions[bot] avatar Feb 07 '24 16:02 github-actions[bot]

Linux Gen12 failure is not related, failing everywhere:

Failed Tests (1):
  SYCL :: ESIMD/aot_mixed.cpp

sarnex avatar Feb 07 '24 20:02 sarnex

@intel/dpcpp-esimd-reviewers @intel/dpcpp-tools-reviewers Ping, thanks!

sarnex avatar Feb 21 '24 18:02 sarnex

Windows fail is not related

sarnex avatar Feb 28 '24 19:02 sarnex