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

Initial support for compiler attribute statements #729

Merged

Conversation

noelchalmers
Copy link
Contributor

Description

This added a generic ability of the OCCA parser to allow qualifier_t tokens to take arguments, and adds the __attribute__ keyword as a qualifier. Consequently, some initial __attribute__ and dllexport__ statements should be possible.

This is useful when using some backend-specific compiler attributes on variables/functions, e.g.

@kernel
__attribute__((amdgpu_waves_per_eu(1,1)))
void myKernel(...)

or when needing specific variable traits, e.g. with AMD GPUs and MFMA instructions:

for(int l=0;l<64;++l;@inner(0)){
  __attribute__((__vector_size__(4 * 8))) double C = {0.};
  
  ...

  // C = A*B
  C = __builtin_amdgcn_mfma_f64_16x16x4f64(A, B, C, 0, 0, 0);
}

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Merging #729 (4b9dd4d) into development (c17644b) will decrease coverage by 0.28%.
The diff coverage is 32.11%.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #729      +/-   ##
===============================================
- Coverage        75.24%   74.97%   -0.28%     
===============================================
  Files              298      298              
  Lines            19397    19487      +90     
===============================================
+ Hits             14595    14610      +15     
- Misses            4802     4877      +75     
Files Coverage Δ
src/occa/internal/lang/keyword.cpp 82.19% <100.00%> (+0.18%) ⬆️
src/occa/internal/lang/modes/okl.cpp 93.67% <100.00%> (ø)
src/occa/internal/lang/qualifier.hpp 100.00% <ø> (ø)
src/occa/internal/lang/type/vartype.cpp 83.20% <0.00%> (-1.33%) ⬇️
src/occa/internal/lang/variable.cpp 69.76% <0.00%> (-1.67%) ⬇️
src/occa/internal/lang/loaders/typeLoader.cpp 71.55% <39.39%> (-7.45%) ⬇️
src/occa/internal/lang/qualifier.cpp 61.72% <29.23%> (-22.28%) ⬇️

... and 2 files with indirect coverage changes

@kris-rowe kris-rowe merged commit 7a364ea into libocca:development Dec 15, 2023
7 of 8 checks passed
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.

2 participants