Skip to content

Commit d9fb9ac

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (3 commits)
2 parents b1c9f02 + b6a619e commit d9fb9ac

File tree

6 files changed

+75
-10
lines changed

6 files changed

+75
-10
lines changed

.github/workflows/sycl-rel-nightly-launch.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,29 @@ jobs:
1717
permissions:
1818
actions: write
1919
runs-on: ubuntu-latest
20+
strategy:
21+
# Keep the matrix even if there is only one branch.
22+
matrix:
23+
branch: [sycl-rel-6_2, sycl-rel-6_3]
2024
steps:
21-
- name: Launch
25+
- name: Launch for ${{ matrix.branch }}
2226
env:
2327
GH_TOKEN: ${{ github.token }}
24-
# To avoid excessive scheduled runs this script also checks if there are
25-
# new commits since the last run - it checks if the latest commit is
26-
# older >24h. That means the previous run already tested this commit.
28+
BRANCH: ${{ matrix.branch }}
29+
# To avoid excessive runs this script checks if there are new commits
30+
# since the last run - it checks if the latest commit is older >24h.
31+
# That means the previous run has already tested this commit.
2732
run: |
33+
BRANCH="${{ matrix.branch }}"
2834
if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
29-
latest_commit_time=$(curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/repos/intel/llvm/commits/sycl-rel-6_2 | jq -r '.commit.committer.date')
35+
latest_commit_time=$(curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/repos/intel/llvm/commits/{$BRANCH} | jq -r '.commit.committer.date')
3036
echo $latest_commit_time
3137
latest_commit_epoch=$(date -d "$latest_commit_time" +%s)
3238
now_epoch=$(date +%s)
3339
diff=$((now_epoch - latest_commit_epoch))
3440
if [ "$diff" -lt 86400 ]; then
35-
gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref sycl-rel-6_2
41+
gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref "${BRANCH}"
3642
fi
3743
else
38-
gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref sycl-rel-6_2
44+
gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref "${BRANCH}"
3945
fi

.github/workflows/sycl-rel-nightly.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# The actual version of this workflow can be found on the latest sycl-rel-*
2-
# branch. This file is still needed to launch the workflow on another branches.
1+
# The actual version of this file can be found on the latest sycl-rel-* branch.
2+
# A new release branch copies this file from the latest release branch.
3+
# This file is still needed to launch the workflow on another branches.
34

45
name: SYCL Release Branch Nightly
56

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,12 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) {
17041704
case Intrinsic::amdgcn_fma_legacy:
17051705
case Intrinsic::amdgcn_fract:
17061706
case Intrinsic::amdgcn_sin:
1707+
1708+
// Floating point builtin intrinsics can be folded if accuracy requirements
1709+
// are satisfied in addition to the rules defined for regular floating point
1710+
// operations.
1711+
case Intrinsic::fpbuiltin_sqrt:
1712+
17071713
// The intrinsics below depend on rounding mode in MXCSR.
17081714
case Intrinsic::x86_sse_cvtss2si:
17091715
case Intrinsic::x86_sse_cvtss2si64:
@@ -2623,6 +2629,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
26232629
return ConstantFP::get(Ty->getContext(), U);
26242630
return ConstantFoldFP(atan, APF, Ty);
26252631
case Intrinsic::sqrt:
2632+
case Intrinsic::fpbuiltin_sqrt:
26262633
return ConstantFoldFP(sqrt, APF, Ty);
26272634

26282635
// NVVM Intrinsics:

llvm/test/Transforms/Inline/inline_constprop.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,18 @@ bb.true:
374374
bb.false:
375375
ret float %x
376376
}
377+
378+
define float @caller9() {
379+
; Check that we can constant-prop through fp intrinsics.
380+
;
381+
; CHECK-LABEL: @caller9(
382+
; CHECK-NEXT: ret float 2.000000e+00
383+
%x = call float @callee9(float 16.0)
384+
ret float %x
385+
}
386+
387+
define float @callee9(float %x) {
388+
%s = call fast float @llvm.sqrt.f32(float %x)
389+
%fs = call fast float @llvm.fpbuiltin.sqrt.f32(float %s)
390+
ret float %fs
391+
}

sycl/source/detail/compression.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class ZSTDCompressor {
3333

3434
// Get the singleton instance of the ZSTDCompressor class.
3535
static ZSTDCompressor &GetSingletonInstance() {
36-
static ZSTDCompressor instance;
36+
// Use thread_local to ensure that each thread has its own instance.
37+
// This avoids issues with concurrent access to the ZSTD contexts.
38+
thread_local ZSTDCompressor instance;
3739
return instance;
3840
}
3941

sycl/unittests/compression/CompressionTests.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "../thread_safety/ThreadUtils.h"
910
#include <detail/compression.hpp>
1011
#include <sycl/sycl.hpp>
1112

@@ -79,3 +80,36 @@ TEST(CompressionTest, EmptyInputTest) {
7980
std::string decompressedStr((char *)decompressedData.get(), decompressedSize);
8081
ASSERT_EQ(input, decompressedStr);
8182
}
83+
84+
// Test to check for concurrent compression and decompression.
85+
TEST(CompressionTest, ConcurrentCompressionDecompression) {
86+
std::string data = "Concurrent compression and decompression test!";
87+
88+
constexpr size_t ThreadCount = 20;
89+
90+
Barrier b(ThreadCount);
91+
{
92+
auto testCompressDecompress = [&](size_t threadId) {
93+
b.wait();
94+
size_t compressedDataSize = 0;
95+
auto compressedData = ZSTDCompressor::CompressBlob(
96+
data.c_str(), data.size(), compressedDataSize, 3);
97+
98+
ASSERT_NE(compressedData, nullptr);
99+
ASSERT_GT(compressedDataSize, (size_t)0);
100+
101+
size_t decompressedSize = 0;
102+
auto decompressedData = ZSTDCompressor::DecompressBlob(
103+
compressedData.get(), compressedDataSize, decompressedSize);
104+
105+
ASSERT_NE(decompressedData, nullptr);
106+
ASSERT_GT(decompressedSize, (size_t)0);
107+
108+
std::string decompressedStr((char *)decompressedData.get(),
109+
decompressedSize);
110+
ASSERT_EQ(data, decompressedStr);
111+
};
112+
113+
::ThreadPool MPool(ThreadCount, testCompressDecompress);
114+
}
115+
}

0 commit comments

Comments
 (0)