Skip to content

Conversation

@jle-quel
Copy link
Contributor

@jle-quel jle-quel commented Feb 6, 2023

This PR adds the marray<complex, N> specialization. The marray complex specialization is added using a mixture of free functions and deleting non applicable operators. This causes the marray interface to deviate slightly for the original sycl interface. The marray class is added in the sycl namespace to allow for proper specialization.

This additionally adds tests for the operators, interface, and free functions.

@jle-quel jle-quel mentioned this pull request Feb 6, 2023
@jle-quel
Copy link
Contributor Author

jle-quel commented Feb 6, 2023

See this PR AidanBeltonS/llvm#2 for reference, which will update the in-review proposal intel/llvm#6550

#define _SYCL_EXT_CPLX_FAST_MATH
#endif

#define _SYCL_BEGIN_NAMESPACE namespace sycl {
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 we maybe need to be careful with that, as we did for the other namespace, because of hipsycl where the namespace sycl will just be an alias to cl::so we will need to extent the base namespace and not sycl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just so we are on the same page, do you mean this?

#ifndef _SYCL_CPLX_NAMESPACE
#ifdef __HIPSYCL__
#define _SYCL_CPLX_NAMESPACE hipsycl::sycl::ext::cplx
#else
#define _SYCL_CPLX_NAMESPACE sycl::ext::cplx
#endif
#endif

So defining _SYCL_BEGIN_NAMESPACE to sycl if __HIPSYCL__ does not exist, else hipsycl::sycl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified the namespace to also handle hypsycl, is that what you had in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

template <typename T, std::size_t NumElements>
class marray<sycl::ext::cplx::complex<T>, NumElements> {
private:
using DataT = sycl::ext::cplx::complex<T>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rename DataT do ComplexDataT or ComplexT just for sake of clarity?
I Was confused at the beginning between T and dataT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the type name

}

// subscript operator
reference operator[](std::size_t index) { return MData[index]; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

We use i in the foor loop on top, I guess we we can use i for index everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the variable name

@TApplencourt
Copy link
Collaborator

Thanks a lot for the PR; really sorry for the delay!

@TApplencourt TApplencourt merged commit 1bcf2c9 into argonne-lcf:main Mar 27, 2023
@TApplencourt
Copy link
Collaborator

Really sorry :( Merged!

@jle-quel jle-quel deleted the jle-quel/marray-implementation branch March 28, 2023 08:08
@bd4
Copy link
Contributor

bd4 commented May 30, 2023

It looks like this never passed the CI?

@TApplencourt
Copy link
Collaborator

Yep. But it build, so I thought it was ok.

@jle-quel
Copy link
Contributor Author

This PR has been tested on opencl::cpu, opencl::gpu and nvidia::gpu.

From what I remember, the error came from the CI regarding how DPC++ is installed.
The error was due to undefined symbols

@jle-quel
Copy link
Contributor Author

Also, there was as well, a problem of the clang-format test, which tested with two versions of clang-format; both refusing the formatting of the other

@bd4
Copy link
Contributor

bd4 commented May 31, 2023

This PR has been tested on opencl::cpu, opencl::gpu and nvidia::gpu.

From what I remember, the error came from the CI regarding how DPC++ is installed. The error was due to undefined symbols

Which gpu hardware did you run on? For me many tests fail on L0 Intel Gen9, which is not ideal, but perhaps not highest priority to fix. Waiting in queue to test on PVC, queues have been slow lately.

Re the clang-format nonesense, I disabled the -9 test. Ideally we would have a .clang-format that would make it work the same across versions, but in practice that is a pain; unfortunately they do not prioritize stability in formatting, so it's a loosing battle.

@bd4
Copy link
Contributor

bd4 commented May 31, 2023

Sorry if I sound grumpy - just trying to get this repo in a better tested state, the lack of consistent CI (and no GPU CI) has been a problem for all of us. I think you may have tested on different systems than I have access to, so any info you can remember is helpful. I want to track down if/when things did pass and then add back changes from there to see what broke things. Not so much concerned with CI which was not mature enough, just having all tests pass with a manual run on GPU is what I am looking for as a baseline.

@jle-quel
Copy link
Contributor Author

jle-quel commented Jun 1, 2023

I understand and share your aim.
Within my latest PR (#41) there is the list of backend and device I used to tests my PRs

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