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

Issue #506 has been fixed. #513

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Issue #506 has been fixed. #513

merged 3 commits into from
Jul 30, 2024

Conversation

andrii0lomakin
Copy link
Contributor

@andrii0lomakin andrii0lomakin commented Jul 27, 2024

Issue #506 has been fixed.
Not used nodes, not related to any API or code, has been removed.
GraalVM JIT has been added as provided dependency to improve IDE support.

Mark the backends affected by this PR.

  • OpenCL
  • PTX
  • SPIRV

OS tested

Mark the OS where this PR is tested.

  • Linux
  • OSx
  • Windows

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

  • Yes
  • No

How to test the new patch?

Provide instructions about how to test the new patch.

tornado-test -V uk.ac.manchester.tornado.unittests.TestHello

Not used nodes, not related to any API or code, has been removed.
GraalVM JIT has been added as provided dependency to improve IDE support.
@jjfumero jjfumero self-assigned this Jul 28, 2024
@jjfumero jjfumero added fix Provides a fix OpenCL labels Jul 28, 2024
@jjfumero
Copy link
Member

Thanks for the contribution. It looks much cleaner.
This PR applies for OpenCL backend. I will remove the PTX mark from this PR.

Before we merge, @mikepapadim , can you merge this into a new branch that includes JDK22? I want to see how these plugins will work as they are.

It works on Linux. I will check on OSx.

@jjfumero jjfumero requested a review from stratika July 29, 2024 07:52
@@ -430,39 +366,6 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
}

private static void registerTornadoVMIntrinsicsPlugins(InvocationPlugins plugins) {
final InvocationPlugin tprintfPlugin2 = new InvocationPlugin("tprintf", String.class, Object[].class) {
Copy link
Member

Choose a reason for hiding this comment

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

I see the tprinf intrinsic is removed, which makes sense. We can debug directly using the Debug.printf method.

Copy link
Member

@jjfumero jjfumero left a comment

Choose a reason for hiding this comment

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

LGTM

@jjfumero
Copy link
Member

For completeness: printf function does not work (does not print anything) on Apple M1-M3 OpenCL implementations, despite that it is OpenCL 1.2. This is a driver issue, and nothing related to this PR.

@andrii0lomakin
Copy link
Contributor Author

@jjfumero For completeness, I also observed issues with PTX and vprintf, but because I have not made a deep investigation, I will provide a separate PR + Issue once we start to work with it closely. Right now, we are concentrating on OpenCL kernels. Because the OpenCL backend is the most widely provided, and then we will work on performance optimizations for specific backends.

Copy link
Member

@mikepapadim mikepapadim left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

I also tested with the new port JDK22 and it works.

Comment on lines +107 to +108
public void testPrintIntArray() throws TornadoExecutionPlanException {
assertNotBackend(TornadoVMBackendType.SPIRV);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add also the assertNotBackend check for the PTX type.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, good catch

Copy link
Collaborator

@stratika stratika left a comment

Choose a reason for hiding this comment

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

thanks @andrii0lomakin, it looks really cool to have this feature supported. The code looks good to me. Just one comment regarding the test. I would suggest to extend it to assess also that the printing works with the parallel loop (I already tested it in my laptop and it works).

I will test it in a bit in Windows for sanity check and will let you know.

Comment on lines +53 to +61
private static void printIntArray(IntArray a) {
int firstValue = a.get(0);
int secondValue = a.get(1);

if (a.getSize() > 1) {
Debug.printf("First value %d, second value %d\n", firstValue, secondValue);
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest to complement this test, or add a second one that prints the value of each element in the input array, and uses the @parallel annotation, so that to test the indices passed from the GlobalThreadIdNode.

e.g.,

private static void printIntArray(IntArray a) {
        for (@Parallel int i = 0; i < a.getSize(); i++) {
            Debug.printf("value a[%d] = %d\n", i, a.get(i));
        }
    }

Ideally, we can extend the test to assess all 3 dimensions.

@stratika
Copy link
Collaborator

It works on my laptop with Windows 11.

@andrii0lomakin
Copy link
Contributor Author

Hi @stratika
Thank you for your help.
I have added new tests.

Copy link
Member

@jjfumero jjfumero left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@stratika stratika left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@jjfumero
Copy link
Member

Thanks all, I will merge this PR

@jjfumero jjfumero merged commit f1e670d into beehive-lab:develop Jul 30, 2024
2 checks passed
jjfumero added a commit to jjfumero/TornadoVM that referenced this pull request Aug 30, 2024
Improvements
~~~~~~~~~~~~~~~~~~

- beehive-lab#468: Cleanup Abstract Metadata Class.
- beehive-lab#473: Add maven plugin to build TornadoVM source for the releases.
- beehive-lab#474: Refactor `<X>TornadoDevice` to place common methods in the `TornadoXPUInterface`.
- beehive-lab#482: Help messages improve when an out-of-memory exception is raised.
- beehive-lab#484: Double-type for the trigonometric functions added in the `TornadoMath` class.
- beehive-lab#487: Prebuilt API simplified.
- beehive-lab#494: Add test to trigger unsupported features related to direct use of Memory Segments.
- beehive-lab#509: Add a quick pass configuration to skip the heavy tests during active development.
- beehive-lab#532: Improve thread scheduler to support RISC-V Accelerators from Codeplay.
- beehive-lab#533: Support for scalar values to be passed via lambda expressions as tasks.
- beehive-lab#538: `README` file updated.
- beehive-lab#539: Refactor core classes and add new API methods to pass compilation flags to the low-level driver compilers (OpenCL, PTX and Level Zero).
- beehive-lab#542: Tagged LevelZero JNI and Beehive Toolkit dependencies added in the build and installer.

Compatibility
~~~~~~~~~~~~~~~~~~

- beehive-lab#465: Support for JDK 22 and GraalVM 24.0.2.
- beehive-lab#486: Temurin for Windows added in the list of supported JDKs.
- beehive-lab#525: Revert usage of String Templates in preparation for JDK 23.
- beehive-lab#527: SPIR-V version parameter added. TornadoVM may run previous SPIR-V versions (e.g., ComputeAorta from Codeplay).
- beehive-lab#513: LevelZero JNI Library updated to v0.1.4.

Bug Fixes
~~~~~~~~~~~~~~~~~~

- beehive-lab#470: README documentation fixed.
- beehive-lab#478: Fix the test names that are present in the white list.
- beehive-lab#488: FP64 Kind for radian operations and the PTX backend fixed.
- beehive-lab#493: Tests Whitelist for PTX backend fixed.
- beehive-lab#502: Fix barrier type in the documentation regarding programmability of reductions.
- beehive-lab#514: Installer script fixed.
- beehive-lab#540: Fix  issue with clean-up execution IDs function.
- beehive-lab#541: Fix Data Accessors for the prebuilt API.
- beehive-lab#543: Fix checkstyle condition and FP16 error message improved.
jjfumero added a commit to jjfumero/TornadoVM that referenced this pull request Aug 30, 2024
Improvements
~~~~~~~~~~~~~~~~~~

- beehive-lab#468: Cleanup Abstract Metadata Class.
- beehive-lab#473: Add maven plugin to build TornadoVM source for the releases.
- beehive-lab#474: Refactor `<X>TornadoDevice` to place common methods in the `TornadoXPUInterface`.
- beehive-lab#482: Help messages improved when an out-of-memory exception is raised.
- beehive-lab#484: Double-type for the trigonometric functions added in the `TornadoMath` class.
- beehive-lab#487: Prebuilt API simplified.
- beehive-lab#494: Add test to trigger unsupported features related to direct use of Memory Segments.
- beehive-lab#509: Add a quick pass configuration to skip the heavy tests during active development.
- beehive-lab#532: Improve thread scheduler to support RISC-V Accelerators from Codeplay.
- beehive-lab#533: Support for scalar values to be passed via lambda expressions as tasks.
- beehive-lab#538: `README` file updated.
- beehive-lab#539: Refactor core classes and add new API methods to pass compilation flags to the low-level driver compilers (OpenCL, PTX and Level Zero).
- beehive-lab#542: Tagged LevelZero JNI and Beehive Toolkit dependencies added in the build and installer.

Compatibility
~~~~~~~~~~~~~~~~~~

- beehive-lab#465: Support for JDK 22 and GraalVM 24.0.2.
- beehive-lab#486: Temurin for Windows added in the list of supported JDKs.
- beehive-lab#525: Revert usage of String Templates in preparation for JDK 23.
- beehive-lab#527: SPIR-V version parameter added. TornadoVM may run previous SPIR-V versions (e.g., ComputeAorta from Codeplay).
- beehive-lab#513: LevelZero JNI Library updated to v0.1.4.

Bug Fixes
~~~~~~~~~~~~~~~~~~

- beehive-lab#470: README documentation fixed.
- beehive-lab#478: Fix the test names that are present in the white list.
- beehive-lab#488: FP64 Kind for radian operations and the PTX backend fixed.
- beehive-lab#493: Tests Whitelist for PTX backend fixed.
- beehive-lab#502: Fix barrier type in the documentation regarding programmability of reductions.
- beehive-lab#514: Installer script fixed.
- beehive-lab#540: Fix  issue with clean-up execution IDs function.
- beehive-lab#541: Fix Data Accessors for the prebuilt API.
- beehive-lab#543: Fix checkstyle condition and FP16 error message improved.

minor change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Provides a fix OpenCL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants