mirror of https://github.com/llvm/torch-mlir
[torch-mlir] bump to llvm/llvm-project@9b78ddf3b2 (#3491)
This bump triggered an upstream assert. Includes a WAR for #3506. Also includes several things I needed to do to repro: * When TORCH_MLIR_TEST_CONCURRENCY=1, test runs will be printed. * Added TORCH_MLIR_TEST_VERBOSE=1 handling to enable verbose mode (useful on CI). --------- Co-authored-by: Stella Laurenzo <stellaraccident@gmail.com>pull/3508/head
parent
6d0ca499e6
commit
1f73895f93
|
@ -429,6 +429,20 @@ cd projects/pt1
|
||||||
python -m e2e_testing.main -f 'AtenEmbeddingBag'
|
python -m e2e_testing.main -f 'AtenEmbeddingBag'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The default mode of running tests uses the multi-processing framework and is
|
||||||
|
not tolerant of certain types of errors. If encountering native crashes/hangs,
|
||||||
|
enable debug variables to run sequentially/in-process with more verbosity:
|
||||||
|
|
||||||
|
```
|
||||||
|
export TORCH_MLIR_TEST_CONCURRENCY=1
|
||||||
|
export TORCH_MLIR_TEST_VERBOSE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
In this way, you can run under `gdb`, etc and get useful results. Having env
|
||||||
|
vars like this makes it easy to set in GH action files, etc. Note that the
|
||||||
|
verbose flags are very verbose. Basic sequential progress reports will be
|
||||||
|
printed regardless when not running in parallel.
|
||||||
|
|
||||||
## Running unit tests.
|
## Running unit tests.
|
||||||
|
|
||||||
To run all of the unit tests, run:
|
To run all of the unit tests, run:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5207632f8698a2fab0c4cdcdf2f7ad9aaf96e06f
|
Subproject commit 9b78ddf3b2abfb3e2063e3dad2a326f5eabc1618
|
|
@ -46,16 +46,17 @@ using namespace mlir::torch::TMTensor;
|
||||||
static void getEffectsImpl(
|
static void getEffectsImpl(
|
||||||
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
||||||
&effects,
|
&effects,
|
||||||
ValueRange results, ValueRange inputBuffers, ValueRange outputBuffers) {
|
ResultRange results, ArrayRef<OpOperand *> inputBuffers,
|
||||||
for (Value value : results) {
|
ArrayRef<OpOperand *> outputBuffers) {
|
||||||
|
for (OpResult value : results) {
|
||||||
effects.emplace_back(MemoryEffects::Allocate::get(), value,
|
effects.emplace_back(MemoryEffects::Allocate::get(), value,
|
||||||
SideEffects::DefaultResource::get());
|
SideEffects::DefaultResource::get());
|
||||||
}
|
}
|
||||||
for (Value value : inputBuffers) {
|
for (OpOperand *value : inputBuffers) {
|
||||||
effects.emplace_back(MemoryEffects::Read::get(), value,
|
effects.emplace_back(MemoryEffects::Read::get(), value,
|
||||||
SideEffects::DefaultResource::get());
|
SideEffects::DefaultResource::get());
|
||||||
}
|
}
|
||||||
for (Value value : outputBuffers) {
|
for (OpOperand *value : outputBuffers) {
|
||||||
effects.emplace_back(MemoryEffects::Read::get(), value,
|
effects.emplace_back(MemoryEffects::Read::get(), value,
|
||||||
SideEffects::DefaultResource::get());
|
SideEffects::DefaultResource::get());
|
||||||
effects.emplace_back(MemoryEffects::Write::get(), value,
|
effects.emplace_back(MemoryEffects::Write::get(), value,
|
||||||
|
@ -1121,8 +1122,8 @@ bool TopkOp::payloadUsesValueFromOperand(OpOperand *opOperand) {
|
||||||
void OP_NAME::getEffects( \
|
void OP_NAME::getEffects( \
|
||||||
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> \
|
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> \
|
||||||
&effects) { \
|
&effects) { \
|
||||||
SmallVector<Value> inputBuffers = getInputBufferOperands(); \
|
OpOperandVector inputBuffers = getInputBufferOperands(); \
|
||||||
SmallVector<Value> outputBuffers = getOutputBufferOperands(); \
|
OpOperandVector outputBuffers = getOutputBufferOperands(); \
|
||||||
getEffectsImpl(effects, getOperation()->getResults(), inputBuffers, \
|
getEffectsImpl(effects, getOperation()->getResults(), inputBuffers, \
|
||||||
outputBuffers); \
|
outputBuffers); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -2810,7 +2810,8 @@ LogicalResult CopyToNonValueTensorOp::inferReturnTypes(
|
||||||
void CopyToNonValueTensorOp::getEffects(
|
void CopyToNonValueTensorOp::getEffects(
|
||||||
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
||||||
&effects) {
|
&effects) {
|
||||||
effects.emplace_back(MemoryEffects::Allocate::get(), getResult());
|
effects.emplace_back(MemoryEffects::Allocate::get(),
|
||||||
|
getOperation()->getOpResult(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -2837,7 +2838,8 @@ LogicalResult CopyToValueTensorOp::inferReturnTypes(
|
||||||
void CopyToValueTensorOp::getEffects(
|
void CopyToValueTensorOp::getEffects(
|
||||||
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
|
||||||
&effects) {
|
&effects) {
|
||||||
effects.emplace_back(MemoryEffects::Read::get(), getOperand());
|
effects.emplace_back(MemoryEffects::Read::get(),
|
||||||
|
&getOperation()->getOpOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -7,6 +7,10 @@ import argparse
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
torch.device("cpu")
|
||||||
|
|
||||||
from torch_mlir_e2e_test.framework import run_tests
|
from torch_mlir_e2e_test.framework import run_tests
|
||||||
from torch_mlir_e2e_test.reporting import report_results
|
from torch_mlir_e2e_test.reporting import report_results
|
||||||
from torch_mlir_e2e_test.registry import GLOBAL_TEST_REGISTRY
|
from torch_mlir_e2e_test.registry import GLOBAL_TEST_REGISTRY
|
||||||
|
|
|
@ -358,6 +358,15 @@ def run_tests(
|
||||||
if env_concurrency > 0:
|
if env_concurrency > 0:
|
||||||
num_processes = min(num_processes, env_concurrency)
|
num_processes = min(num_processes, env_concurrency)
|
||||||
|
|
||||||
|
try:
|
||||||
|
env_verbose = os.getenv("TORCH_MLIR_TEST_VERBOSE", "0")
|
||||||
|
if env_verbose is not None:
|
||||||
|
verbose = bool(int(env_verbose))
|
||||||
|
except ValueError as e:
|
||||||
|
raise ValueError(
|
||||||
|
"Bad value for TORCH_MLIR_TEST_VERBOSE env var: " "Expected integer."
|
||||||
|
) from e
|
||||||
|
|
||||||
# TODO: We've noticed that on certain 2 core machine parallelizing the tests
|
# TODO: We've noticed that on certain 2 core machine parallelizing the tests
|
||||||
# makes the llvm backend legacy pass manager 20x slower than using a
|
# makes the llvm backend legacy pass manager 20x slower than using a
|
||||||
# single process. Need to investigate the root cause eventually. This is a
|
# single process. Need to investigate the root cause eventually. This is a
|
||||||
|
@ -375,7 +384,10 @@ def run_tests(
|
||||||
# seems to cause a cascade of failures resulting in undecipherable error
|
# seems to cause a cascade of failures resulting in undecipherable error
|
||||||
# messages.
|
# messages.
|
||||||
if num_processes == 1 or sequential:
|
if num_processes == 1 or sequential:
|
||||||
return [compile_and_run_test(test, config, verbose) for test in tests]
|
print("Running tests sequentially with progress status")
|
||||||
|
for test in tests:
|
||||||
|
print(f"*** RUNNING TEST: {test.unique_name} ***")
|
||||||
|
compile_and_run_test(test, config, verbose)
|
||||||
|
|
||||||
# This is needed because autograd does not support crossing process
|
# This is needed because autograd does not support crossing process
|
||||||
# boundaries.
|
# boundaries.
|
||||||
|
|
|
@ -40,6 +40,9 @@ def run_pipeline_with_repro_report(
|
||||||
)
|
)
|
||||||
# Lower module in place to make it ready for compiler backends.
|
# Lower module in place to make it ready for compiler backends.
|
||||||
with module.context as ctx:
|
with module.context as ctx:
|
||||||
|
# TODO(#3506): Passes can emit errors but not signal failure,
|
||||||
|
# which causes a native assert.
|
||||||
|
ctx.emit_error_diagnostics = True
|
||||||
pm = PassManager.parse(pipeline)
|
pm = PassManager.parse(pipeline)
|
||||||
if enable_ir_printing:
|
if enable_ir_printing:
|
||||||
ctx.enable_multithreading(False)
|
ctx.enable_multithreading(False)
|
||||||
|
|
Loading…
Reference in New Issue