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

Prebuilt API test using a multi-backend setup and selecting specific device #549

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

jjfumero
Copy link
Member

@jjfumero jjfumero commented Sep 2, 2024

Description

Test required to run the GAIA/AERO project to use a specific device within a setup a multiple devices and backends installed.

Problem description

n/ a.

Backend/s tested

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?

$ make BACKEND=opencl,ptx

$ tornado-test --threadInfo -V uk.ac.manchester.tornado.unittests.prebuilt.PrebuiltTests#testPrebuiltMutiBackend

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Task info: s0.t0
	Backend           : PTX
	Device            : NVIDIA GeForce GTX 1050 GPU
	Dims              : 1
	Thread dimensions : [8, 1, 1]
	Blocks dimensions : [8, 1, 1]
	Grids dimensions  : [1, 1, 1]

Test: class uk.ac.manchester.tornado.unittests.prebuilt.PrebuiltTests#testPrebuiltMutiBackend
	Running test: testPrebuiltMutiBackend    ................  [PASS] 
Test ran: 1, Failed: 0, Unsupported: 0

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

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.

minor comment, LGTM since the functionality is as expected when having one backend. let me know your thoughts @jjfumero.

For the record, I also tested the <spirv, ptx> combination and works on Linux.

@@ -254,7 +254,7 @@ else:

ENABLE_ASSERTIONS = "-ea "

__VERSION__ = "1.0.7"
__VERSION__ = "1.0.7-dev"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be 1.0.8-dev, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right. I will fix this

Comment on lines +377 to +386
TornadoDeviceMap tornadoDeviceMap = TornadoExecutionPlan.getTornadoDeviceMap();
if (tornadoDeviceMap.getNumBackends() < 2) {
throw new TornadoVMMultiDeviceNotSupported("Test designed to run with multiple backends");
}

List<TornadoBackend> ptxBackend = tornadoDeviceMap.getBackendsWithPredicate(backend -> backend.getBackendType() == TornadoVMBackendType.PTX);

if (ptxBackend == null || ptxBackend.isEmpty()) {
throw new TornadoVMPTXNotSupported("Test designed to run with multiple backends, including a PTX backend");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not very keen to have the check in the test body. Shall we change to something like the following condition

assertAvailableDrivers(2);

that exists in TestConcurrentBackends.java class.

The condition should assert if (OpenCL, PTX) or (SPIR-V, PTX) backends have been built, otherwise result in UNSUPPORTED result.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to check that at least two drivers are installed, and one of them must be the PTX to pass this particular test. The combinations are also valid for any two backend combination in which the selected device is not the default device. I think the throw exception here is fine.

@jjfumero jjfumero merged commit 6612338 into beehive-lab:develop Sep 3, 2024
2 checks passed
@jjfumero jjfumero deleted the fix/prebuilt/devices branch September 3, 2024 07:48
jjfumero added a commit to jjfumero/TornadoVM that referenced this pull request Sep 30, 2024
Improvements
============
- beehive-lab#565: New API call in the Execution Plan to log/trace the executed configuration plans.
- beehive-lab#563: Expand the TornadoVM profiler with Level Zero Sysman Energy Metrics.
- beehive-lab#559: Refactoring Power Metric handlers for PTX and OpenCL.
- beehive-lab#548: Benchmarking improvements.
- beehive-lab#549: Prebuilt API tests added using multiple backend-setup.
- Add internal tests for monitoring memory management [link](beehive-lab@0644225).

Compatibility
=============
- beehive-lab#561: Build for OSx 14.6 and OSx 15 fixed.

Bug Fixes
==============
- beehive-lab#564: Jenkins configuration fixed to run KFusion per backend.
- beehive-lab#562: Warmup action from the Execution Plan fixed to run with correct internal IDs.
- beehive-lab#557: Shared Execution Plans Context fixed.
- beehive-lab#553: OpenCL compiler flags for Intel Integrated GPUs fixed.
- beehive-lab#552: Fixed runtime to select any device among multiple SPIR-V devices.
- Fixed zero extend arithmetic operations: [link](beehive-lab@ea7b602).
@jjfumero jjfumero mentioned this pull request Sep 30, 2024
8 tasks
jjfumero added a commit to jjfumero/TornadoVM that referenced this pull request Sep 30, 2024
Improvements
============
- beehive-lab#565: New API call in the Execution Plan to log/trace the executed configuration plans.
- beehive-lab#563: Expand the TornadoVM profiler with Level Zero Sysman Energy Metrics.
- beehive-lab#559: Refactoring Power Metric handlers for PTX and OpenCL.
- beehive-lab#548: Benchmarking improvements.
- beehive-lab#549: Prebuilt API tests added using multiple backend-setup.
- Add internal tests for monitoring memory management [link](beehive-lab@0644225).

Compatibility
=============
- beehive-lab#561: Build for OSx 14.6 and OSx 15 fixed.

Bug Fixes
==============
- beehive-lab#564: Jenkins configuration fixed to run KFusion per backend.
- beehive-lab#562: Warmup action from the Execution Plan fixed to run with correct internal IDs.
- beehive-lab#557: Shared Execution Plans Context fixed.
- beehive-lab#553: OpenCL compiler flags for Intel Integrated GPUs fixed.
- beehive-lab#552: Fixed runtime to select any device among multiple SPIR-V devices.
- Fixed zero extend arithmetic operations: [link](beehive-lab@ea7b602).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants