Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

''tutorial-opt': command not found' during test #40

Open
xiangzho72 opened this issue May 3, 2024 · 5 comments
Open

''tutorial-opt': command not found' during test #40

xiangzho72 opened this issue May 3, 2024 · 5 comments

Comments

@xiangzho72
Copy link

Hello,

Firstly thanks very much for the tutorial which is very informative for ones who has little knowledge on LLVM.

I'm following charters one by one, and in the section 3'writing first pass', I met with problem in the test using command 'bazel test tests:all" :
'
//tests:ctlz.mlir.test PASSED in 0.4s
//tests:ctlz_runner.mlir.test PASSED in 0.9s
//tests:ctlz_simple.mlir.test PASSED in 0.4s
//tests:affine_loop_unroll.mlir.test FAILED in 0.3s
/home/user/.cache/bazel/_bazel_user/0d9e230fafe092ac5e7f4f9c63722bf8/execroot/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.log
//tests:mul_to_add.mlir.test FAILED in 0.3s
/home/user/.cache/bazel/_bazel_user/0d9e230fafe092ac5e7f4f9c63722bf8/execroot/_main/bazel-out/k8-fastbuild/testlogs/tests/mul_to_add.mlir.test/test.log'

The issue is that '

.---command stderr------------

| 'tutorial-opt': command not found

`-----------------------------

error: command failed with exit status: 127

'
However, I could use 'bazel run tools:tutorial-opt -- -affine-full-unroll ${PWD}/tests/affine_loop_unroll.mlir' to run this test successfully.

I checked the directory tree for bazel-bin/tests/affine_loop_unroll.mlir.test.runfiles/, it doesn't have '/mlir_tutorial/' as suggested in lit.cfg.py. And here are the output when I enable commented code in lit.cfg.py. I'm on Ubuntu 20.04, can you please help me to check what could be wrong in my setup ?

Xiang

================================================================================
INFO: From Testing //tests:affine_loop_unroll.mlir.test:
==================== Test output for //tests:affine_loop_unroll.mlir.test:
/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/_main
total 16
-rw-rw-r-- 1 user user 0 May 2 09:38 init.py
drwxr-xr-x 5 user user 4096 May 2 09:17 _main
lrwxrwxrwx 1 user user 100 May 2 09:38 _repo_mapping -> /tmp/bazel-execroot/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.repo_mapping
drwxr-xr-x 3 user user 4096 May 2 09:17 bazel_tools
drwxr-xr-x 4 user user 4096 May 2 09:17 llvm-project
TEST_TMPDIR=/tmp/bazel-working-directory/_main/_tmp/885145028d2433fde581bc0498024cb7
JAVA_RUNFILES=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles
USER=user
TEST_LOGSPLITTER_OUTPUT_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.raw_splitlogs/test.splitlogs
BAZEL_TEST=1
SHLVL=0
LD_LIBRARY_PATH=:/usr/local/cuda-11.6/lib64
OLDPWD=/tmp/bazel-working-directory/_main
TEST_PREMATURE_EXIT_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.exited_prematurely
TEST_SIZE=small
TEST_UNDECLARED_OUTPUTS_DIR=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.outputs
TEST_TIMEOUT=60
LC_CTYPE=C.UTF-8
PYTHONSAFEPATH=1
XML_OUTPUT_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.xml
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.outputs_manifest
TMPDIR=/tmp
TEST_UNUSED_RUNFILES_LOG_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.unused_runfiles_log
RUN_UNDER_RUNFILES=1
PYTHON_RUNFILES=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles
_=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/_main/tests/affine_loop_unroll.mlir.test
EXPERIMENTAL_SPLIT_XML_GENERATION=1
BAZEL_CXXOPTS=-std=c++17
PATH=.:/home/user/anaconda3/bin:/home/user/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda-11.6/bin:/home/user/tools/
RUNFILES_DIR=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles
TEST_INFRASTRUCTURE_FAILURE_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.infrastructure_failure
TEST_BINARY=tests/affine_loop_unroll.mlir.test
TEST_WORKSPACE=_main
TEST_SRCDIR=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles
TEST_TARGET=//tests:affine_loop_unroll.mlir.test
PWD=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/_main
PYTHONPATH=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles:/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/:/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/_main:/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/bazel_tools:/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/llvm-project
TZ=UTC
GTEST_TMP_DIR=/tmp/bazel-working-directory/_main/_tmp/885145028d2433fde581bc0498024cb7
TEST_WARNINGS_OUTPUT_FILE=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/testlogs/tests/affine_loop_unroll.mlir.test/test.warnings
None
None
None
-- Testing: 1 tests, 1 workers --
FAIL: mlir_tutorial :: affine_loop_unroll.mlir (1 of 1)
******************** TEST 'mlir_tutorial :: affine_loop_unroll.mlir' FAILED ********************
Exit Code: 127

@j2kun
Copy link
Owner

j2kun commented May 3, 2024

Could you let me know which specific commit you've checked out? That way I can try to reproduce it.

Generally speaking, this list (at HEAD) describes which set of binaries are available to the lit test runner, and this list specifies their relative paths during the test execution (relative to this path).

@j2kun
Copy link
Owner

j2kun commented May 3, 2024

Looking at your printed output, that is very strange... It looks like your PWD is PWD=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/tests/affine_loop_unroll.mlir.test.runfiles/_main, which is not what I'd expect. What is _main? I think that should be mlir_tutorial

Perhaps you named the directory that contains the project _main? If so, try changing the use of mlir_tutorial in lit.cfg.py to _main... that might work?

@xiangzho72
Copy link
Author

xiangzho72 commented May 4, 2024

Thanks for the quick response. And yes, you are right, after changing 'mlir_tutorial' to '_main' in the lit.cfg.py, it just works(i.e. all tests passed). But I didn't name any directory contains project '_main', Maybe this is driven by my bazel being version 7.1.1 ? (And I'm on branch writing-first-pass. And commit id as: b17efb4)

@j2kun
Copy link
Owner

j2kun commented May 4, 2024

I think what I didn't quite understand until you filed this issue is how dependent the lit config is to the particular name of the project directory. I'm guessing you'd see the same error if you git checkout the project into a non-default directory name (say, _main). I can try to modify the lit config to be more resilient, but also note that it wouldn't retroactively apply to all the tutorials.

@ziereis
Copy link

ziereis commented May 16, 2024

I had a similar issue that when trying to run the tests it didn't find tutorial-opt. After looking into the bin dir I also saw that there is only a _main. I did rename my project root and rebuild everything, and it fixed the problem. Maybe a note for people that follow the tutorial in their own dir would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants