Skip to content

Commit 4b2b904

Browse files
committed
fix lit
1 parent dfbaad2 commit 4b2b904

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

llvm/include/llvm/SYCLLowerIR/CompileTimePropertiesPass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CompileTimePropertiesPass
4040
Module &M, IntrinsicInst *IntrInst,
4141
SmallVectorImpl<IntrinsicInst *> &RemovableAnnotations);
4242

43-
void parseAlignmentAndApply(Module &M, IntrinsicInst *IntrInst);
43+
bool parseAlignmentAndApply(Module &M, IntrinsicInst *IntrInst);
4444

4545
// Map for keeping track of global variables generated for annotation strings.
4646
// This allows reuse for annotations with the same generated annotation

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ PreservedAnalyses CompileTimePropertiesPass::run(Module &M,
683683
: PreservedAnalyses::all();
684684
}
685685

686-
void CompileTimePropertiesPass::parseAlignmentAndApply(
686+
bool CompileTimePropertiesPass::parseAlignmentAndApply(
687687
Module &M, IntrinsicInst *IntrInst) {
688688
// Get the global variable with the annotation string.
689689
const GlobalVariable *AnnotStrArgGV = nullptr;
@@ -693,11 +693,11 @@ void CompileTimePropertiesPass::parseAlignmentAndApply(
693693
else if (auto *GEP = dyn_cast<GEPOperator>(IntrAnnotStringArg))
694694
AnnotStrArgGV = dyn_cast<GlobalVariable>(GEP->getOperand(0));
695695
if (!AnnotStrArgGV)
696-
return;
696+
return false;
697697

698698
std::optional<StringRef> AnnotStr = getGlobalVariableString(AnnotStrArgGV);
699699
if (!AnnotStr)
700-
return;
700+
return false;
701701

702702
// parse properties string to decoration-value pairs
703703
auto Properties = parseSYCLPropertiesString(M, IntrInst);
@@ -708,6 +708,7 @@ void CompileTimePropertiesPass::parseAlignmentAndApply(
708708
getUserListIgnoringCast<StoreInst>(IntrInst, TargetedInstList);
709709
getUserListIgnoringCast<MemTransferInst>(IntrInst, TargetedInstList);
710710

711+
bool AlignApplied = false;
711712
for (auto &Property : Properties) {
712713
auto DecorStr = Property.first->str();
713714
auto DecorValue = Property.second;
@@ -731,18 +732,26 @@ void CompileTimePropertiesPass::parseAlignmentAndApply(
731732
auto Op_num = Pair.second;
732733
if (auto *LInst = dyn_cast<LoadInst>(Inst)) {
733734
LInst->setAlignment(Align_val);
735+
AlignApplied = true;
734736
} else if (auto *SInst = dyn_cast<StoreInst>(Inst)) {
735-
if (Op_num == 1)
737+
if (Op_num == 1) {
736738
SInst->setAlignment(Align_val);
739+
AlignApplied = true;
740+
}
737741
} else if (auto *MI = dyn_cast<MemTransferInst>(Inst)) {
738-
if (Op_num == 0)
742+
if (Op_num == 0) {
739743
MI->setDestAlignment(Align_val);
740-
else if (Op_num == 1)
744+
AlignApplied = true;
745+
} else if (Op_num == 1) {
741746
MI->setSourceAlignment(Align_val);
747+
AlignApplied = true;
748+
}
742749
}
743750
}
744751
}
745752
}
753+
754+
return AlignApplied;
746755
}
747756

748757
// Returns true if the transformation changed IntrInst.
@@ -771,7 +780,7 @@ bool CompileTimePropertiesPass::transformSYCLPropertiesAnnotation(
771780
return false;
772781

773782
// check alignment annotation and apply it to load/store
774-
parseAlignmentAndApply(M, IntrInst);
783+
bool AlignApplied = parseAlignmentAndApply(M, IntrInst);
775784

776785
// Read the annotation values and create new annotation strings.
777786
std::string NewAnnotString = "";
@@ -780,6 +789,11 @@ bool CompileTimePropertiesPass::transformSYCLPropertiesAnnotation(
780789
bool CacheProp = false;
781790
bool FPGAProp = false;
782791
for (const auto &[PropName, PropVal] : Properties) {
792+
// if sycl-alignment is converted to align on IR constructs
793+
// during parseAlignmentAndApply(), dropping here
794+
if (PropName == "sycl-alignment" && AlignApplied)
795+
continue;
796+
783797
auto DecorIt = SpirvDecorMap.find(*PropName);
784798
if (DecorIt == SpirvDecorMap.end())
785799
continue;

sycl/include/sycl/ext/intel/experimental/fpga_annotated_properties.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,6 @@ struct is_valid_property<T, stable_key::value_t> : std::true_type {};
356356
// buffer_location is applied on PtrAnnotation
357357
template <>
358358
struct propagateToPtrAnnotation<buffer_location_key> : std::true_type {};
359-
template <int K>
360-
struct propagateToPtrAnnotation<buffer_location_key::value_t<K>>
361-
: std::true_type {};
362359

363360
//===----------------------------------------------------------------------===//
364361
// Utility for FPGA properties

sycl/include/sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ struct check_property_list<T, Prop, Props...>
5858

5959
template <typename PropTy> struct propagateToPtrAnnotation : std::false_type {};
6060

61+
// Partial specilization for property_value
62+
template <typename PropKeyT, typename... PropValuesTs>
63+
struct propagateToPtrAnnotation<property_value<PropKeyT, PropValuesTs...>>
64+
: propagateToPtrAnnotation<PropKeyT> {};
65+
6166
//===----------------------------------------------------------------------===//
6267
// Common properties of annotated_arg/annotated_ptr
6368
//===----------------------------------------------------------------------===//
@@ -83,8 +88,6 @@ struct is_property_key_of<alignment_key, annotated_arg<T, PropertyListT>>
8388
: std::true_type {};
8489

8590
template <> struct propagateToPtrAnnotation<alignment_key> : std::true_type {};
86-
template <int K>
87-
struct propagateToPtrAnnotation<alignment_key::value_t<K>> : std::true_type {};
8891

8992
namespace detail {
9093

sycl/test/extensions/properties/properties_cache_control.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ using namespace ext::intel::experimental;
99

1010
using load_hint = annotated_ptr<
1111
float, decltype(properties(
12-
alignment<8>,
1312
read_hint<cache_control<cache_mode::cached, cache_level::L1>,
1413
cache_control<cache_mode::uncached, cache_level::L2,
1514
cache_level::L3>>))>;
1615
using load_assertion = annotated_ptr<
1716
int,
1817
decltype(properties(
19-
alignment<8>,
2018
read_assertion<cache_control<cache_mode::constant, cache_level::L1>,
2119
cache_control<cache_mode::invalidate, cache_level::L2,
2220
cache_level::L3>>))>;

0 commit comments

Comments
 (0)