beehive-lab / TornadoVM

TornadoVM: A practical and efficient heterogeneous programming framework for managed languages
https://www.tornadovm.org
Apache License 2.0
1.17k stars 110 forks source link

Test VectorAPI with TornadoNative types through Memory Segments for 64 to 512Bit vector #351

Closed mikepapadim closed 5 months ago

mikepapadim commented 5 months ago

Description

This is a follow up PR to #350 .

The PR adds unit-tests to check the connection between TornadoVM native types (invoking the getSegment) and Java Vector API. It adds the following tests:

 test64BitVector   ->  Species[float, 2, S_64_BIT]
 test128BitVector  ->  Species[float, 4, S_128_BIT]
 test256BitVector  ->  Species[float, 8, S_256_BIT]
 test512BitVector  ->  Species[float, 16, S_512_BIT]

Backend/s tested

Mark the backends affected by this PR.

OS tested

Mark the OS where this PR is tested.

How to test the new patch?

make 
tornado-test -V uk.ac.manchester.tornado.unittests.vector.api.TestVectorAPI

jjfumero commented 5 months ago

By looking at the description, the PR adds unit-tests to check the connection between TornadoVM native types (invoking the getSegment) and Java Vector API. In this case, we don't use any of the supported backends. However, you test it for OpenCL. Can you expand?

jjfumero commented 5 months ago

Tests passing on Apple M2 (CPU):

$ tornado-test --threadInfo -V uk.ac.manchester.tornado.unittests.vector.api.TestVectorAPI

WARNING: Using incubator modules: jdk.incubator.vector

Species[float, 2, S_64_BIT]
Species[float, 4, S_128_BIT]
Species[float, 8, S_256_BIT]
Species[float, 16, S_512_BIT]
Test: class uk.ac.manchester.tornado.unittests.vector.api.TestVectorAPI
    Running test: test64BitVectors           ................  [PASS] 
    Running test: test128BitVectors          ................  [PASS] 
    Running test: test256BitVectors          ................  [PASS] 
    Running test: test512BitVectors          ................  [PASS] 
Test ran: 4, Failed: 0, Unsupported: 0
mikepapadim commented 5 months ago

This is ready, there are not other pending changes