Skip to content

Commit 950d1a3

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:00c8da615923 into amd-gfx:1a36b82bb390
Local branch amd-gfx 1a36b82 Merged main:6250afe37fd1 into amd-gfx:d47138e5ab99 Remote branch main 00c8da6 [docs] Fix suggested darker command in coding standards (llvm#69860)
2 parents 1a36b82 + 00c8da6 commit 950d1a3

File tree

21 files changed

+824
-10
lines changed

21 files changed

+824
-10
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
18551855
}
18561856

18571857
if (!found) {
1858+
FileSpec error_dwo_path(dwo_name);
1859+
FileSystem::Instance().Resolve(error_dwo_path);
1860+
if (error_dwo_path.IsRelative() && comp_dir != nullptr) {
1861+
error_dwo_path.PrependPathComponent(comp_dir);
1862+
FileSystem::Instance().Resolve(error_dwo_path);
1863+
}
18581864
unit.SetDwoError(Status::createWithFormat(
18591865
"unable to locate .dwo debug file \"{0}\" for skeleton DIE "
18601866
"{1:x16}",
1861-
dwo_file.GetPath().c_str(), cu_die.GetOffset()));
1867+
error_dwo_path.GetPath().c_str(), cu_die.GetOffset()));
18621868

18631869
if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) {
18641870
GetObjectFile()->GetModule()->ReportWarning(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int main(void) { return 0; }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Check that LLDB prints an error message containing the DWO_AT_comp_dir and
2+
# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and
3+
# DW_AT_dwo_name are relative.
4+
5+
# -gsplit-dwarf is supported only on Linux.
6+
# REQUIRES: system-linux
7+
8+
# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name.
9+
# Creating and compiling to %t.compdir makes it easy to remove the dwo files.
10+
# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be
11+
# "a.out-dwo-missing-error.dwo".
12+
# since %T is deprecated.
13+
# RUN: rm -rf %t.compdir/
14+
# RUN: mkdir -p %t.compdir/a/b/
15+
# RUN: cd %t.compdir/a/b/
16+
# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
17+
# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out
18+
# RUN: rm *.dwo
19+
# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s
20+
# RUN: cd -
21+
22+
# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name.
23+
# RUN: rm -rf %t.compdir/
24+
# RUN: mkdir -p %t.compdir/a/b/
25+
# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
26+
# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out
27+
# RUN: rm %t.compdir/a/b/*.dwo
28+
# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s
29+
30+
b main
31+
run
32+
33+
fr v
34+
# CHECK: error: unable to locate .dwo debug file "{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}}

llvm/docs/CodingStandards.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ For example:
148148

149149
.. code-block:: bash
150150
151-
$ darker -r HEAD^ $(git diff --name-only HEAD^)
151+
$ darker -r HEAD^ $(git diff --name-only --diff-filter=d HEAD^)
152152
153153
Mechanical Source Issues
154154
========================

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 478268
19+
#define LLVM_MAIN_REVISION 478275
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PrintOpLowering : public ConversionPattern {
6161
LogicalResult
6262
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
6363
ConversionPatternRewriter &rewriter) const override {
64-
auto context = rewriter.getContext();
64+
auto *context = rewriter.getContext();
6565
auto memRefType = llvm::cast<MemRefType>((*op->operand_type_begin()));
6666
auto memRefShape = memRefType.getShape();
6767
auto loc = op->getLoc();

mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PrintOpLowering : public ConversionPattern {
6161
LogicalResult
6262
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
6363
ConversionPatternRewriter &rewriter) const override {
64-
auto context = rewriter.getContext();
64+
auto *context = rewriter.getContext();
6565
auto memRefType = llvm::cast<MemRefType>((*op->operand_type_begin()));
6666
auto memRefShape = memRefType.getShape();
6767
auto loc = op->getLoc();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===- IndexToSPIRV.h - Index to SPIRV dialect conversion -------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H
10+
#define MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H
11+
12+
#include "mlir/Pass/Pass.h"
13+
#include <memory>
14+
15+
namespace mlir {
16+
class RewritePatternSet;
17+
class SPIRVTypeConverter;
18+
class Pass;
19+
20+
#define GEN_PASS_DECL_CONVERTINDEXTOSPIRVPASS
21+
#include "mlir/Conversion/Passes.h.inc"
22+
23+
namespace index {
24+
void populateIndexToSPIRVPatterns(SPIRVTypeConverter &converter,
25+
RewritePatternSet &patterns);
26+
std::unique_ptr<OperationPass<>> createConvertIndexToSPIRVPass();
27+
} // namespace index
28+
} // namespace mlir
29+
30+
#endif // MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H

mlir/include/mlir/Conversion/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
3636
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
3737
#include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
38+
#include "mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h"
3839
#include "mlir/Conversion/LinalgToStandard/LinalgToStandard.h"
3940
#include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
4041
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"

mlir/include/mlir/Conversion/Passes.td

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,28 @@ def ConvertIndexToLLVMPass : Pass<"convert-index-to-llvm"> {
644644
];
645645
}
646646

647+
//===----------------------------------------------------------------------===//
648+
// ConvertIndexToSPIRVPass
649+
//===----------------------------------------------------------------------===//
650+
651+
def ConvertIndexToSPIRVPass : Pass<"convert-index-to-spirv"> {
652+
let summary = "Lower the `index` dialect to the `spirv` dialect.";
653+
let description = [{
654+
This pass lowers Index dialect operations to SPIR-V dialect operations.
655+
Operation conversions are 1-to-1 except for the exotic divides: `ceildivs`,
656+
`ceildivu`, and `floordivs`. The index bitwidth will be 32 or 64 as
657+
specified by use-64bit-index.
658+
}];
659+
660+
let dependentDialects = ["::mlir::spirv::SPIRVDialect"];
661+
662+
let options = [
663+
Option<"use64bitIndex", "use-64bit-index",
664+
"bool", /*default=*/"false",
665+
"Use 64-bit integers to convert index types">
666+
];
667+
}
668+
647669
//===----------------------------------------------------------------------===//
648670
// LinalgToStandard
649671
//===----------------------------------------------------------------------===//

mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ struct SPIRVConversionOptions {
5555
/// values will be packed into one 32-bit value to be memory efficient.
5656
bool emulateLT32BitScalarTypes{true};
5757

58-
/// Use 64-bit integers to convert index types.
59-
bool use64bitIndex{false};
60-
6158
/// Whether to enable fast math mode during conversion. If true, various
6259
/// patterns would assume no NaN/infinity numbers as inputs, and thus there
6360
/// will be no special guards emitted to check and handle such cases.
6461
bool enableFastMathMode{false};
62+
63+
/// Use 64-bit integers when converting index types.
64+
bool use64bitIndex{false};
6565
};
6666

6767
/// Type conversion from builtin types to SPIR-V types for shader interface.
@@ -77,6 +77,11 @@ class SPIRVTypeConverter : public TypeConverter {
7777
/// Gets the SPIR-V correspondence for the standard index type.
7878
Type getIndexType() const;
7979

80+
/// Gets the bitwidth of the index type when converted to SPIR-V.
81+
unsigned getIndexTypeBitwidth() const {
82+
return options.use64bitIndex ? 64 : 32;
83+
}
84+
8085
const spirv::TargetEnv &getTargetEnv() const { return targetEnv; }
8186

8287
/// Returns the options controlling the SPIR-V type converter.

mlir/lib/Analysis/CallGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ CallGraphNode *CallGraph::getOrAddNode(Region *region,
133133
/// Lookup a call graph node for the given region, or nullptr if none is
134134
/// registered.
135135
CallGraphNode *CallGraph::lookupNode(Region *region) const {
136-
auto it = nodes.find(region);
136+
const auto *it = nodes.find(region);
137137
return it == nodes.end() ? nullptr : it->second.get();
138138
}
139139

mlir/lib/Bytecode/Writer/IRNumbering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ struct NumberingResourceBuilder : public AsmResourceBuilder {
557557
void numberEntry(StringRef key) {
558558
// TODO: We could pre-number resource key strings here as well.
559559

560-
auto it = dialect->resourceMap.find(key);
560+
auto *it = dialect->resourceMap.find(key);
561561
if (it != dialect->resourceMap.end()) {
562562
it->second->number = nextResourceID++;
563563
it->second->isDeclaration = false;

mlir/lib/Conversion/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_subdirectory(GPUToROCDL)
2424
add_subdirectory(GPUToSPIRV)
2525
add_subdirectory(GPUToVulkan)
2626
add_subdirectory(IndexToLLVM)
27+
add_subdirectory(IndexToSPIRV)
2728
add_subdirectory(LinalgToStandard)
2829
add_subdirectory(LLVMCommon)
2930
add_subdirectory(MathToFuncs)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
add_mlir_conversion_library(MLIRIndexToSPIRV
2+
IndexToSPIRV.cpp
3+
4+
ADDITIONAL_HEADER_DIRS
5+
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/IndexToSPIRV
6+
7+
DEPENDS
8+
MLIRConversionPassIncGen
9+
10+
LINK_COMPONENTS
11+
Core
12+
13+
LINK_LIBS PUBLIC
14+
MLIRIndexDialect
15+
MLIRSPIRVConversion
16+
MLIRSPIRVDialect
17+
)

0 commit comments

Comments
 (0)