Skip to content

Commit 0576f51

Browse files
authored
merge main into amd-staging (#640)
2 parents 6541ffb + 51299f0 commit 0576f51

File tree

70 files changed

+3339
-2281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3339
-2281
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
/mlir/lib/Conversion/*ToROCDL @krzysz00 @kuhar
6161
/mlir/include/mlir/Dialect/LLVMIR/ROCDL* @krzysz00 @kuhar
6262

63+
# Arith dialect in MLIR.
64+
/mlir/include/mlir/Dialect/Arith @kuhar
65+
/mlir/lib/Dialect/Arith @kuhar
66+
/mlir/lib/Conversion/ArithTo* @kuhar
67+
6368
# XeGPU and XeVM dialects in MLIR.
6469
/mlir/include/mlir/Dialect/XeGPU @charithaintc @Jianhui-Li
6570
/mlir/lib/Dialect/XeGPU @charithaintc @Jianhui-Li

clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ dependencies::createCompilerInvocation(ArrayRef<std::string> CommandLine,
432432
}
433433

434434
std::pair<IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::vector<std::string>>
435-
dependencies::initVFSForTUBuferScanning(
435+
dependencies::initVFSForTUBufferScanning(
436436
IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS,
437437
ArrayRef<std::string> CommandLine, StringRef WorkingDirectory,
438438
llvm::MemoryBufferRef TUBuffer) {

clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ createCompilerInvocation(ArrayRef<std::string> CommandLine,
113113
DiagnosticsEngine &Diags);
114114

115115
std::pair<IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::vector<std::string>>
116-
initVFSForTUBuferScanning(IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS,
117-
ArrayRef<std::string> CommandLine,
118-
StringRef WorkingDirectory,
119-
llvm::MemoryBufferRef TUBuffer);
116+
initVFSForTUBufferScanning(IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS,
117+
ArrayRef<std::string> CommandLine,
118+
StringRef WorkingDirectory,
119+
llvm::MemoryBufferRef TUBuffer);
120120

121121
std::pair<IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>,
122122
std::vector<std::string>>

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool DependencyScanningWorker::computeDependencies(
157157
DependencyConsumer &Consumer, DependencyActionController &Controller,
158158
DiagnosticConsumer &DC, std::optional<llvm::MemoryBufferRef> TUBuffer) {
159159
if (TUBuffer) {
160-
auto [FinalFS, FinalCommandLine] = initVFSForTUBuferScanning(
160+
auto [FinalFS, FinalCommandLine] = initVFSForTUBufferScanning(
161161
BaseFS, CommandLine, WorkingDirectory, *TUBuffer);
162162
return scanDependencies(WorkingDirectory, FinalCommandLine, Consumer,
163163
Controller, DC, FinalFS);

compiler-rt/test/asan/TestCases/stack_container_dynamic_lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test to demonstrate compile-time disabling of container-overflow checks
22
// in order to handle uninstrumented libraries
3-
// UNSUPPORTED: target={{.*windows-msvc.*}}
3+
// UNSUPPORTED: target={{.*windows-.*}}
44

55
// Mimic a closed-source library compiled without ASan
66
// RUN: %clangxx_asan -fno-sanitize=address -DSHARED_LIB %s %fPIC -shared -o %t-so.so

flang/include/flang/Optimizer/Builder/CUFCommon.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ int computeElementByteSize(mlir::Location loc, mlir::Type type,
3939
fir::KindMapping &kindMap,
4040
bool emitErrorOnFailure = true);
4141

42+
mlir::Value computeElementCount(mlir::PatternRewriter &rewriter,
43+
mlir::Location loc, mlir::Value shapeOperand,
44+
mlir::Type seqType, mlir::Type targetType);
45+
4246
} // namespace cuf
4347

4448
#endif // FORTRAN_OPTIMIZER_TRANSFORMS_CUFCOMMON_H_

flang/lib/Optimizer/Builder/CUFCommon.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,44 @@ int cuf::computeElementByteSize(mlir::Location loc, mlir::Type type,
114114
mlir::emitError(loc, "unsupported type");
115115
return 0;
116116
}
117+
118+
mlir::Value cuf::computeElementCount(mlir::PatternRewriter &rewriter,
119+
mlir::Location loc,
120+
mlir::Value shapeOperand,
121+
mlir::Type seqType,
122+
mlir::Type targetType) {
123+
if (shapeOperand) {
124+
// Dynamic extent - extract from shape operand
125+
llvm::SmallVector<mlir::Value> extents;
126+
if (auto shapeOp =
127+
mlir::dyn_cast<fir::ShapeOp>(shapeOperand.getDefiningOp())) {
128+
extents = shapeOp.getExtents();
129+
} else if (auto shapeShiftOp = mlir::dyn_cast<fir::ShapeShiftOp>(
130+
shapeOperand.getDefiningOp())) {
131+
for (auto i : llvm::enumerate(shapeShiftOp.getPairs()))
132+
if (i.index() & 1)
133+
extents.push_back(i.value());
134+
}
135+
136+
if (extents.empty())
137+
return mlir::Value();
138+
139+
// Compute total element count by multiplying all dimensions
140+
mlir::Value count =
141+
fir::ConvertOp::create(rewriter, loc, targetType, extents[0]);
142+
for (unsigned i = 1; i < extents.size(); ++i) {
143+
auto operand =
144+
fir::ConvertOp::create(rewriter, loc, targetType, extents[i]);
145+
count = mlir::arith::MulIOp::create(rewriter, loc, count, operand);
146+
}
147+
return count;
148+
} else {
149+
// Static extent - use constant array size
150+
if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(seqType)) {
151+
mlir::IntegerAttr attr =
152+
rewriter.getIntegerAttr(targetType, seqTy.getConstantArraySize());
153+
return mlir::arith::ConstantOp::create(rewriter, loc, targetType, attr);
154+
}
155+
}
156+
return mlir::Value();
157+
}

flang/lib/Optimizer/Transforms/CUFOpConversion.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -651,31 +651,8 @@ struct CUFDataTransferOpConversion
651651
}
652652

653653
mlir::Type i64Ty = builder.getI64Type();
654-
mlir::Value nbElement;
655-
if (op.getShape()) {
656-
llvm::SmallVector<mlir::Value> extents;
657-
if (auto shapeOp =
658-
mlir::dyn_cast<fir::ShapeOp>(op.getShape().getDefiningOp())) {
659-
extents = shapeOp.getExtents();
660-
} else if (auto shapeShiftOp = mlir::dyn_cast<fir::ShapeShiftOp>(
661-
op.getShape().getDefiningOp())) {
662-
for (auto i : llvm::enumerate(shapeShiftOp.getPairs()))
663-
if (i.index() & 1)
664-
extents.push_back(i.value());
665-
}
666-
667-
nbElement = fir::ConvertOp::create(rewriter, loc, i64Ty, extents[0]);
668-
for (unsigned i = 1; i < extents.size(); ++i) {
669-
auto operand =
670-
fir::ConvertOp::create(rewriter, loc, i64Ty, extents[i]);
671-
nbElement =
672-
mlir::arith::MulIOp::create(rewriter, loc, nbElement, operand);
673-
}
674-
} else {
675-
if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(dstTy))
676-
nbElement = builder.createIntegerConstant(
677-
loc, i64Ty, seqTy.getConstantArraySize());
678-
}
654+
mlir::Value nbElement =
655+
cuf::computeElementCount(rewriter, loc, op.getShape(), dstTy, i64Ty);
679656
unsigned width = 0;
680657
if (fir::isa_derived(fir::unwrapSequenceType(dstTy))) {
681658
mlir::Type structTy =

libc/cmake/caches/armv6m-none-eabi.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
22
set(RUNTIMES_TARGET_TRIPLE "armv6m-none-eabi" CACHE STRING "")
33

44
foreach(lang C;CXX;ASM)
5-
set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
5+
set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
66
endforeach()
77

88
include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)

libc/cmake/caches/armv7em-none-eabi.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
22
set(RUNTIMES_TARGET_TRIPLE "armv7em-none-eabi" CACHE STRING "")
33

44
foreach(lang C;CXX;ASM)
5-
set(CMAKE_${lang}_FLAGS "-march=armv7em -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
5+
set(CMAKE_${lang}_FLAGS "-march=armv7em -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
66
endforeach()
77

88
include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)

0 commit comments

Comments
 (0)