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

[NFC][SYCL] Update tests to reflect new offload model #14539

Merged
merged 7 commits into from
Jul 16, 2024

Conversation

mdtoguchi
Copy link
Contributor

Update existing SYCL based driver tests to use the new offload model and retain the equivalent old offloading model tests be creating copies. These tests use the --offload-new-driver and --no-offload-new-driver options to force a particular model to follow.

Update existing SYCL based driver tests to use the new offload model and
retain the equivalent old offloading model tests be creating copies.
These tests use the --offload-new-driver and --no-offload-new-driver
options to force a particular model to follow.
@mdtoguchi mdtoguchi requested a review from a team as a code owner July 11, 2024 16:42

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Make three distinct BC files
// RUN: %clangxx -fsycl -fsycl-device-only -DTYPE1 %s -o %t1.bc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is --no-offload-new-driver not required here?
I see it added here for generating BC files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is required - will add.

@@ -0,0 +1,20 @@
// Test -ftarget-compile-fast behaviors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the comments are updated with // Old offloading model only
Can be made consistent by updating all comments as necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files that are commented with 'Old offload model only' are tests that already exist that were not converted for the new model as those behaviors being tested do not make sense for the new model.

@@ -1,20 +1,21 @@
// Test -ftarget-compile-fast behaviors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment can be updated to mention the use of new offload driver

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files where an 'old-model' variant was added I do not update the comments to reflect. The naming should take care of that. Once the old model goes away, all of these tests will also be updated to remove the --offload-new-driver options being set.

// RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image -fsycl-targets=spir64 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT
// RUN: %clang -### -fsycl --no-offload-new-driver -fsycl-add-default-spec-consts-image 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT
// RUN: %clang_cl -### -fsycl --no-offload-new-driver -fsycl-add-default-spec-consts-image 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT
// RUN: %clang -### -fsycl --no-offload-new-driver -fsycl-add-default-spec-consts-image -fsycl-targets=spir64 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT
// CHECK-NON-AOT: warning: -fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT)

// Check that non-AOT target doesn't add command line option into sycl-post-link invocation
// CHECK-NON-AOT-NOT: {{.*}}sycl-post-link{{.*}} "-generate-device-image-default-spec-consts"

// Check that no warnings are issued in correct cases and "-generate-device-image-default-spec-consts" is passed to sycl-post-link
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify?

@@ -0,0 +1,233 @@
///
/// Perform several driver tests for SYCL device libraries on Linux
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test file for tests using the new offload driver?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, no. Any device libraries or objects aren't touched by the driver with the new model, so there aren't any behaviors to verify.

@@ -7,227 +7,184 @@
/// ###########################################################################

/// test behavior of device library default link and fno-sycl-device-lib-jit-link
// RUN: %clangxx -fsycl %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
// RUN: %clangxx -fsycl --offload-new-driver %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - filename can be updated to mention new offload model.

// CHECK-DEFAULT-NOT: "-fsycl-is-device"

/// Check "-fsycl-is-device" is passed when compiling for device:
// RUN: %clang -### -fsycl-device-only %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should --no-offload-new-driver be passed here?


/// Check that "-Wno-sycl-strict" is set on compiler invocation with "-fsycl"
/// or "-fsycl-device-only" or both:
// RUN: %clang -### -fsycl %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, should --no-offload-new-driver be used here?

// CHECK-SYCL-AUX-TRIPLE: clang{{.*}} "-aux-triple" "aarch64-unknown-linux-gnu"

/// Verify output files are properly specified given -o
// RUN: %clang -### -fsycl -fsycl-device-only -o dummy.out %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above.

// CHECK-SYCL-STD_VERSION: clang{{.*}} "-sycl-std=2020"

/// Check that -aux-triple is set correctly
// RUN: %clang -### -fsycl -target aarch64-linux-gnu %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question.

@@ -1,11 +1,11 @@
/// Check that optimizations for sycl device are enabled by default:
// RUN: %clang -### -fsycl %s 2>&1 \
// RUN: %clang -### -fsycl --offload-new-driver %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: All test files with the the old driver option have "old model" in their name.
Test files with the new driver model can have their names updated too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not shuffle the names around too much. The idea is that the 'old model' will be going away once we make it the default, so the files renamed as 'old-model' can just be removed (as well as the existing tests that weren't converted to the new offloading model)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about this a little, and I'm going to rename all of the tests that I'm not converting/adding to the new model to use 'old-model'. This way, we know which ones will go away cleanly (have old-model in the name) and we don't have to worry about the comments.


#include <sycl/sycl.hpp>
#include <sycl/sycl.hpp>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the non-visual changes are due to a cleanup of some carriage return characters.

// RUN: cmp %t_unbundled.o `grep .o$ %t_list.txt`

void foo() {
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment - non-visual changes to clean up carriage return characters.

@mdtoguchi
Copy link
Contributor Author

@intel/llvm-gatekeepers, please take a look, should be ready for merge.

@sarnex sarnex merged commit 7515da8 into intel:sycl Jul 16, 2024
14 checks passed
smanna12 pushed a commit to smanna12/llvm that referenced this pull request Jul 16, 2024
Update existing SYCL based driver tests to use the new offload model and
retain the equivalent old offloading model tests be creating copies.
These tests use the --offload-new-driver and --no-offload-new-driver
options to force a particular model to follow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants