Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sycl' into ben/graph-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Bensuo committed Jan 11, 2024
2 parents 79e7066 + 8aa2b61 commit dd88644
Show file tree
Hide file tree
Showing 98 changed files with 3,369 additions and 1,924 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/sycl_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ jobs:
cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries
- name: Install lint utilities
# We install these into our nightly container that CI uses to run lint
# checks.
run: |
cmake --build $GITHUB_WORKSPACE/build --target install-clang-format
cmake --build $GITHUB_WORKSPACE/build --target install-clang-tidy
- name: Pack toolchain
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/build/install .
Expand Down
35 changes: 2 additions & 33 deletions .github/workflows/sycl_linux_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,9 @@ jobs:
detect_changes:
uses: ./.github/workflows/sycl_detect_changes.yml

lint:
runs-on: [Linux, build]
if: ${{ always() && !contains(github.event.pull_request.labels.*.name, 'disable-lint') }}
container:
image: ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:no-drivers
options: -u 1001:1001
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: |
devops/actions/cached_checkout
devops/actions/clang-format
devops/actions/cleanup
- name: Register cleanup after job is finished
uses: ./devops/actions/cleanup
- name: 'PR commits + 2'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 2 ))" >> "${GITHUB_ENV}"
- uses: ./devops/actions/cached_checkout
with:
path: src
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
ref: ${{ github.event.pull_request.head.sha }}
merge_ref: ''
cache_path: "/__w/repo_cache/"
- name: Run clang-format
uses: ./devops/actions/clang-format
with:
path: src

build:
needs: [lint, detect_changes]
if: |
always()
&& (success() || needs.lint.result == 'skipped')
needs: [detect_changes]
if: always() && success()
uses: ./.github/workflows/sycl_linux_build.yml
with:
build_ref: ${{ github.sha }}
Expand Down
35 changes: 2 additions & 33 deletions .github/workflows/sycl_windows_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,10 @@ jobs:
detect_changes:
uses: ./.github/workflows/sycl_detect_changes.yml

lint:
runs-on: [Linux, build]
if: ${{ always() && !contains(github.event.pull_request.labels.*.name, 'disable-lint') }}
container:
image: ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:no-drivers
options: -u 1001:1001
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
sparse-checkout: |
devops/actions/cached_checkout
devops/actions/clang-format
devops/actions/cleanup
- name: Register cleanup after job is finished
uses: ./devops/actions/cleanup
- name: 'PR commits + 2'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 2 ))" >> "${GITHUB_ENV}"
- uses: ./devops/actions/cached_checkout
with:
path: src
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
ref: ${{ github.event.pull_request.head.sha }}
merge_ref: ''
cache_path: "/__w/repo_cache/"
- name: Run clang-format
uses: ./devops/actions/clang-format
with:
path: src

build:
needs: [lint, detect_changes]
needs: [detect_changes]
if: |
always()
&& (success() || needs.lint.result == 'skipped')
always() && success()
&& github.repository == 'intel/llvm'
uses: ./.github/workflows/sycl_windows_build.yml
with:
Expand Down
56 changes: 50 additions & 6 deletions clang/lib/Sema/SemaStmtAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,50 @@ CheckForDuplicationSYCLLoopAttribute(Sema &S,
}
}

// Diagnose non-identical duplicates as a 'conflicting' loop attributes
// and suppress duplicate errors in cases where the two match for
// FPGA attributes: 'SYCLIntelMaxInterleavingAttr',
// 'SYCLIntelSpeculatedIterationsAttr', and
// 'SYCLIntelMaxReinvocationDelayAttr'.
template <typename LoopAttrT>
static void CheckForDuplicateAttrs(Sema &S, ArrayRef<const Attr *> Attrs) {
auto FindFunc = [](const Attr *A) { return isa<const LoopAttrT>(A); };
const auto *FirstItr = std::find_if(Attrs.begin(), Attrs.end(), FindFunc);

if (FirstItr == Attrs.end()) // no attributes found
return;

const auto *LastFoundItr = FirstItr;
std::optional<llvm::APSInt> FirstValue;

const auto *CAFA =
dyn_cast<ConstantExpr>(cast<LoopAttrT>(*FirstItr)->getNExpr());
// Return early if first expression is dependent (since we don't
// know what the effective size will be), and skip the loop entirely.
if (!CAFA)
return;

while (Attrs.end() != (LastFoundItr = std::find_if(LastFoundItr + 1,
Attrs.end(), FindFunc))) {
const auto *CASA =
dyn_cast<ConstantExpr>(cast<LoopAttrT>(*LastFoundItr)->getNExpr());
// If the value is dependent, we can not test anything.
if (!CASA)
return;
// Test the attribute values.
llvm::APSInt SecondValue = CASA->getResultAsAPSInt();
if (!FirstValue)
FirstValue = CAFA->getResultAsAPSInt();

if (FirstValue != SecondValue) {
S.Diag((*LastFoundItr)->getLocation(), diag::err_loop_attr_conflict)
<< *FirstItr;
S.Diag((*FirstItr)->getLocation(), diag::note_previous_attribute);
return;
}
}
}

static void CheckForIncompatibleSYCLLoopAttributes(
Sema &S, const SmallVectorImpl<const Attr *> &Attrs) {
CheckForDuplicationSYCLLoopAttribute<SYCLIntelInitiationIntervalAttr>(
Expand All @@ -977,16 +1021,13 @@ static void CheckForIncompatibleSYCLLoopAttributes(
CheckForDuplicationSYCLLoopAttribute<SYCLIntelLoopCoalesceAttr>(S, Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelDisableLoopPipeliningAttr>(
S, Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelMaxInterleavingAttr>(S,
Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelSpeculatedIterationsAttr>(
S, Attrs);
CheckForDuplicateAttrs<SYCLIntelMaxInterleavingAttr>(S, Attrs);
CheckForDuplicateAttrs<SYCLIntelSpeculatedIterationsAttr>(S, Attrs);
CheckForDuplicateSYCLIntelLoopCountAttrs(S, Attrs);
CheckForDuplicationSYCLLoopAttribute<LoopUnrollHintAttr>(S, Attrs, false);
CheckRedundantSYCLIntelIVDepAttrs(S, Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelNofusionAttr>(S, Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelMaxReinvocationDelayAttr>(
S, Attrs);
CheckForDuplicateAttrs<SYCLIntelMaxReinvocationDelayAttr>(S, Attrs);
CheckForDuplicationSYCLLoopAttribute<SYCLIntelEnableLoopPipeliningAttr>(
S, Attrs);
}
Expand Down Expand Up @@ -1169,6 +1210,9 @@ void Sema::ProcessStmtAttributes(Stmt *S, const ParsedAttributes &InAttrs,

bool Sema::CheckRebuiltAttributedStmtAttributes(ArrayRef<const Attr *> Attrs) {
CheckRedundantSYCLIntelIVDepAttrs(*this, Attrs);
CheckForDuplicateAttrs<SYCLIntelSpeculatedIterationsAttr>(*this, Attrs);
CheckForDuplicateAttrs<SYCLIntelMaxInterleavingAttr>(*this, Attrs);
CheckForDuplicateAttrs<SYCLIntelMaxReinvocationDelayAttr>(*this, Attrs);
return false;
}

Expand Down
Loading

0 comments on commit dd88644

Please sign in to comment.