Skip to content

ran out of registers during register allocation #21

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

Closed
stappersg opened this issue May 21, 2022 · 5 comments
Closed

ran out of registers during register allocation #21

stappersg opened this issue May 21, 2022 · 5 comments

Comments

@stappersg
Copy link
Member

Hi,

The succesfull build I got in #20, is not yet a succes for publish.

$ AVR_CPU_FREQUENCY_HZ=8_000_000 cargo +nightly publish --target ./avr-atmega328p.json -Z build-std=core
    Updating crates.io index
   Packaging avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Verifying avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.95
   Compiling compiler_builtins v0.1.71
   Compiling core v0.0.0 (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling quote v1.0.18
   Compiling const_env_impl--value v0.1.2
   Compiling const_env--value v0.1.2
   Compiling rustc-std-workspace-core v1.99.0 (/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error: ran out of registers during register allocation

/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x4e81c3)[0x7fe4d5b481c3]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12200)[0x7fe4d52b3200]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(_ZN4llvm12MachineInstr10addOperandERNS_15MachineFunctionERKNS_14MachineOperandE+0x207)[0x7fe4d22eac37]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(+0x4ba822d)[0x7fe4d4ac822d]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(+0x4ba7f2f)[0x7fe4d4ac7f2f]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0xa2)[0x7fe4d2cdba92]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x6aa)[0x7fe4d2d2ad4a]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7fe4d2d2a67f]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.63.0-nightly.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x280)[0x7fe4d31b86c0]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x2671775)[0x7fe4d7cd1775]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x266a827)[0x7fe4d7cca827]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x266db56)[0x7fe4d7ccdb56]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x2668b08)[0x7fe4d7cc8b08]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x26629a3)[0x7fe4d7cc29a3]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x26315ef)[0x7fe4d7c915ef]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3a280b26b15e2fbc.so(+0x26534e3)[0x7fe4d7cb34e3]
/home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/libstd-977ece543e1e3d2f.so(rust_metadata_std_1180f58d9f3ee399+0xab3f3)[0x7fe4d538f3f3]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7d80)[0x7fe4d52a8d80]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fe4d51b676f]
error: could not compile `core` due to previous error

Caused by:
  process didn't exit successfully:
    `rustc --crate-name core --edition=2021
     /home/stappers/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs
     --error-format=json
     --json=diagnostic-rendered-ansi,artifacts,future-incompat
     --crate-type lib --emit=dep-info,metadata,link -C
     embed-bitcode=no -C debuginfo=2 -C metadata=6bea1b9a86127c23
     -C extra-filename=-6bea1b9a86127c23 --out-dir
     /home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0/target/avr-atmega328p/debug/deps
     --target /home/stappers/src/rust/RustAVR/delay/avr-atmega328p.json
     -Z force-unstable-if-unmarked -L
     dependency=/home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0/target/avr-atmega328p/debug/deps
     -L
     dependency=/home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0/target/debug/deps
     --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to verify package tarball
$ 

This is blocking #19.

@stappersg
Copy link
Member Author

From JuliaLang/julia#42200 do I understand that this a LLVM issue.

I think that avoiding ran out of registers during register allocation can be done with tuning rustc-std-workspace-core v1.99.0.

@lord-ne
Copy link

lord-ne commented Jun 9, 2022

I think we can use the --no-verify option to publish without building, which will avoid this error.

The crate can successfully build, but only in release mode. Since the version that's currently on crates.io doesn't work at all, I think it would still be better to publish this, even though it can't build in debug mode.

stappersg added a commit that referenced this issue Jun 9, 2022
Date: Thu, 09 Jun 2022 01:16:09 -0700
From: lord-ne <notifications@github.com>
To: avr-rust/delay <delay@noreply.github.com>
Cc: Geert Stappers <stappers@stappers.it>, Author <author@noreply.github.com>
Subject: Re: [avr-rust/delay] ran out of registers during register allocation (Issue #21)

I think we can use the --no-verify option to publish without building,
which will avoid this error.

The crate *can* successfully build, but only in release mode. Since the
version that's currently on crates.io doesn't work at all, I think it
would still be better to publish this, even though it can't build in
debug mode.

--
Reply to this email directly or view it on GitHub:
#21 (comment)
You are receiving this because you authored the thread.

Message ID: </issues/21/1150815568@github.com>
@stappersg
Copy link
Member Author

Yes, I agree that adding --no-verify can get us beyond "ran out ofregisters during register allocation".

$ cargo publish --no-verify
    Updating crates.io index
   Packaging avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Uploading avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: A verified email address is required to publish crates to crates.io.
  Visit https://crates.io/me to set and verify your email address.
$ 

(Issue left open as an invitation for expressing further ideas on this.)

@lord-ne
Copy link

lord-ne commented Jun 10, 2022

On the rewrite branch, just doing cargo publish (without specifying --target or -Z build-std) works successfully.

@stappersg
Copy link
Member Author

Nice!

That does bring the project further.

Now closing this issue, because we have #19 for tracking a first release done by me.

What follows is something that confirms what @lord-ne observation and that I have confirmed my email address at crates.io.

stappers@myhost:~/src/rust/RustAVR/delay
$ cargo publish
    Updating crates.io index
   Packaging avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Verifying avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.95
   Compiling quote v1.0.18
   Compiling const_env_impl--value v0.1.2
   Compiling const_env--value v0.1.2
   Compiling avr-config v2.0.1
   Compiling avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0)
error: invalid register class `reg_iw`: unknown register class
  --> src/lib.rs:41:18
   |
41 |                  i = inout(reg_iw) zero => _,
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: invalid register class `reg_iw`: unknown register class
  --> src/lib.rs:48:14
   |
48 |              i = inout(reg_iw) last_count => _,
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `avr_delay` due to 2 previous errors
error: failed to verify package tarball
stappers@myhost:~/src/rust/RustAVR/delay
$ git checkout rewrite 
Switched to branch 'rewrite'
Your branch is up to date with 'origin/rewrite'.
stappers@myhost:~/src/rust/RustAVR/delay
$ cargo publish
    Updating crates.io index
   Packaging avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Verifying avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.95
   Compiling quote v1.0.18
   Compiling const_env_impl--value v0.1.2
   Compiling const_env--value v0.1.2
   Compiling avr-config v2.0.1
   Compiling avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0)
    Finished dev [unoptimized + debuginfo] target(s) in 4.67s
   Uploading avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: A verified email address is required to publish crates to crates.io. Visit https://crates.io/me to set and verify your email address.
stappers@myhost:~/src/rust/RustAVR/delay
$ cargo publish
    Updating crates.io index
   Packaging avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Verifying avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.95
   Compiling quote v1.0.18
   Compiling const_env_impl--value v0.1.2
   Compiling const_env--value v0.1.2
   Compiling avr-config v2.0.1
   Compiling avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay/target/package/avr_delay-0.4.0)
    Finished dev [unoptimized + debuginfo] target(s) in 4.68s
   Uploading avr_delay v0.4.0 (/home/stappers/src/rust/RustAVR/delay)
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: this crate exists but you don't seem to be an owner. If you believe this is a mistake, perhaps you need to accept an invitation to be an owner before publishing.
stappers@myhost:~/src/rust/RustAVR/delay
$ 

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

2 participants