Skip to content

Commit

Permalink
Merged main:00c8da615923 into amd-gfx:1a36b82bb390
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
SC llvm team authored and SC llvm team committed Oct 22, 2023
2 parents 1a36b82 + 00c8da6 commit 950d1a3
Show file tree
Hide file tree
Showing 21 changed files with 824 additions and 10 deletions.
8 changes: 7 additions & 1 deletion lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
}

if (!found) {
FileSpec error_dwo_path(dwo_name);
FileSystem::Instance().Resolve(error_dwo_path);
if (error_dwo_path.IsRelative() && comp_dir != nullptr) {
error_dwo_path.PrependPathComponent(comp_dir);
FileSystem::Instance().Resolve(error_dwo_path);
}
unit.SetDwoError(Status::createWithFormat(
"unable to locate .dwo debug file \"{0}\" for skeleton DIE "
"{1:x16}",
dwo_file.GetPath().c_str(), cu_die.GetOffset()));
error_dwo_path.GetPath().c_str(), cu_die.GetOffset()));

if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) {
GetObjectFile()->GetModule()->ReportWarning(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main(void) { return 0; }
34 changes: 34 additions & 0 deletions lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Check that LLDB prints an error message containing the DWO_AT_comp_dir and
# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and
# DW_AT_dwo_name are relative.

# -gsplit-dwarf is supported only on Linux.
# REQUIRES: system-linux

# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name.
# Creating and compiling to %t.compdir makes it easy to remove the dwo files.
# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be
# "a.out-dwo-missing-error.dwo".
# since %T is deprecated.
# RUN: rm -rf %t.compdir/
# RUN: mkdir -p %t.compdir/a/b/
# RUN: cd %t.compdir/a/b/
# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out
# RUN: rm *.dwo
# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s
# RUN: cd -

# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name.
# RUN: rm -rf %t.compdir/
# RUN: mkdir -p %t.compdir/a/b/
# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out
# RUN: rm %t.compdir/a/b/*.dwo
# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s

b main
run

fr v
# CHECK: error: unable to locate .dwo debug file "{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}}
2 changes: 1 addition & 1 deletion llvm/docs/CodingStandards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ For example:

.. code-block:: bash
$ darker -r HEAD^ $(git diff --name-only HEAD^)
$ darker -r HEAD^ $(git diff --name-only --diff-filter=d HEAD^)
Mechanical Source Issues
========================
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

/* Define if LLVM_ENABLE_DUMP is enabled */
#cmakedefine LLVM_ENABLE_DUMP
Expand Down
2 changes: 1 addition & 1 deletion mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PrintOpLowering : public ConversionPattern {
LogicalResult
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto context = rewriter.getContext();
auto *context = rewriter.getContext();
auto memRefType = llvm::cast<MemRefType>((*op->operand_type_begin()));
auto memRefShape = memRefType.getShape();
auto loc = op->getLoc();
Expand Down
2 changes: 1 addition & 1 deletion mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PrintOpLowering : public ConversionPattern {
LogicalResult
matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto context = rewriter.getContext();
auto *context = rewriter.getContext();
auto memRefType = llvm::cast<MemRefType>((*op->operand_type_begin()));
auto memRefShape = memRefType.getShape();
auto loc = op->getLoc();
Expand Down
30 changes: 30 additions & 0 deletions mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//===- IndexToSPIRV.h - Index to SPIRV dialect conversion -------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H
#define MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H

#include "mlir/Pass/Pass.h"
#include <memory>

namespace mlir {
class RewritePatternSet;
class SPIRVTypeConverter;
class Pass;

#define GEN_PASS_DECL_CONVERTINDEXTOSPIRVPASS
#include "mlir/Conversion/Passes.h.inc"

namespace index {
void populateIndexToSPIRVPatterns(SPIRVTypeConverter &converter,
RewritePatternSet &patterns);
std::unique_ptr<OperationPass<>> createConvertIndexToSPIRVPass();
} // namespace index
} // namespace mlir

#endif // MLIR_CONVERSION_INDEXTOSPIRV_INDEXTOSPIRV_H
1 change: 1 addition & 0 deletions mlir/include/mlir/Conversion/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
#include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
#include "mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h"
#include "mlir/Conversion/LinalgToStandard/LinalgToStandard.h"
#include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
Expand Down
22 changes: 22 additions & 0 deletions mlir/include/mlir/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,28 @@ def ConvertIndexToLLVMPass : Pass<"convert-index-to-llvm"> {
];
}

//===----------------------------------------------------------------------===//
// ConvertIndexToSPIRVPass
//===----------------------------------------------------------------------===//

def ConvertIndexToSPIRVPass : Pass<"convert-index-to-spirv"> {
let summary = "Lower the `index` dialect to the `spirv` dialect.";
let description = [{
This pass lowers Index dialect operations to SPIR-V dialect operations.
Operation conversions are 1-to-1 except for the exotic divides: `ceildivs`,
`ceildivu`, and `floordivs`. The index bitwidth will be 32 or 64 as
specified by use-64bit-index.
}];

let dependentDialects = ["::mlir::spirv::SPIRVDialect"];

let options = [
Option<"use64bitIndex", "use-64bit-index",
"bool", /*default=*/"false",
"Use 64-bit integers to convert index types">
];
}

//===----------------------------------------------------------------------===//
// LinalgToStandard
//===----------------------------------------------------------------------===//
Expand Down
11 changes: 8 additions & 3 deletions mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ struct SPIRVConversionOptions {
/// values will be packed into one 32-bit value to be memory efficient.
bool emulateLT32BitScalarTypes{true};

/// Use 64-bit integers to convert index types.
bool use64bitIndex{false};

/// Whether to enable fast math mode during conversion. If true, various
/// patterns would assume no NaN/infinity numbers as inputs, and thus there
/// will be no special guards emitted to check and handle such cases.
bool enableFastMathMode{false};

/// Use 64-bit integers when converting index types.
bool use64bitIndex{false};
};

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

/// Gets the bitwidth of the index type when converted to SPIR-V.
unsigned getIndexTypeBitwidth() const {
return options.use64bitIndex ? 64 : 32;
}

const spirv::TargetEnv &getTargetEnv() const { return targetEnv; }

/// Returns the options controlling the SPIR-V type converter.
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Analysis/CallGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ CallGraphNode *CallGraph::getOrAddNode(Region *region,
/// Lookup a call graph node for the given region, or nullptr if none is
/// registered.
CallGraphNode *CallGraph::lookupNode(Region *region) const {
auto it = nodes.find(region);
const auto *it = nodes.find(region);
return it == nodes.end() ? nullptr : it->second.get();
}

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Bytecode/Writer/IRNumbering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ struct NumberingResourceBuilder : public AsmResourceBuilder {
void numberEntry(StringRef key) {
// TODO: We could pre-number resource key strings here as well.

auto it = dialect->resourceMap.find(key);
auto *it = dialect->resourceMap.find(key);
if (it != dialect->resourceMap.end()) {
it->second->number = nextResourceID++;
it->second->isDeclaration = false;
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_subdirectory(GPUToROCDL)
add_subdirectory(GPUToSPIRV)
add_subdirectory(GPUToVulkan)
add_subdirectory(IndexToLLVM)
add_subdirectory(IndexToSPIRV)
add_subdirectory(LinalgToStandard)
add_subdirectory(LLVMCommon)
add_subdirectory(MathToFuncs)
Expand Down
17 changes: 17 additions & 0 deletions mlir/lib/Conversion/IndexToSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
add_mlir_conversion_library(MLIRIndexToSPIRV
IndexToSPIRV.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/IndexToSPIRV

DEPENDS
MLIRConversionPassIncGen

LINK_COMPONENTS
Core

LINK_LIBS PUBLIC
MLIRIndexDialect
MLIRSPIRVConversion
MLIRSPIRVDialect
)
Loading

0 comments on commit 950d1a3

Please sign in to comment.