profile
viewpoint

bjorn3/inline_asm_catalogue 9

Catalogue of asm! snippets to help the discussion about stabilization of inline asm

bjorn3/goodgame_empire_import 4

A importer for goodgame empire

bjorn3/fractals 3

Just some experiments

bjorn3/firefox_tab_organize 2

Organize and manipulate large amounts of tabs at once

bjorn3/bjorn3.github.io 1

bjorn3.github.io

bjorn3/cargo-bisect-rustc-bot-jobs 1

This repo contains the cargo bisect-rustc jobs for my bot

bjorn3/goodgame_empire_helpers 1

Helpers for goodgame empire

bjorn3/addr2line 0

A cross-platform `addr2line` clone written in Rust, using `gimli`

delete branch bjorn3/rust

delete branch : cg_clif_subtree3

delete time in 2 hours

pull request commentEmbarkStudios/rust-gpu

Convert to use `glam` for math types

https://github.com/EmbarkStudios/rust-gpu/blob/75ca54546b6b1e6de753040ced4749835dc33e11/rustc_codegen_spirv/src/codegen_cx/constant.rs#L408 asserts that padding bytes are undef while at the same type padding bytes of contained types are not undef. Neither has to be true.

repi

comment created time in 3 hours

Pull request review commentbitshifter/glam-rs

Initial SPIRV no_std implementation

+pub trait MathExt {+    fn pow(self, factor: Self) -> Self;+    fn sqrt(self) -> Self;+    fn log2(self) -> Self;+    fn abs(self) -> Self;+    fn cos(self) -> Self;+    fn sin(self) -> Self;+    fn sin_cos(self) -> (f32, f32);+    fn round(self) -> Self;+    fn floor(self) -> Self;+    fn ceil(self) -> Self;+    fn exp(self) -> Self;+    fn saturate(self) -> Self;++    fn signum(self) -> Self;+    fn copysign(self, sign: Self) -> Self;++    // TODO: implement but need new intrinsic in core?+    //fn tan(self) -> Self;

LLVM doesn't have a tan intrinsic, unlike all the other methods here.

repi

comment created time in 3 hours

PullRequestReviewEvent

issue commentEmbarkStudios/rust-gpu

Implement copysignf32

copysign can be implemented using bit manipulation. I think the following will work:

f32::from_bits((this.to_bits() & (u32::max_value() >> 1)) | (sign.to_bits() & (1 << 31)))
repi

comment created time in 4 hours

issue commentrust-analyzer/rust-analyzer

Semantic Highlighting: impl Iterator is considered callable

I think what happens is because of the + {error} the question if it implements FnOnce results in an ambiguous solution. This will then cause impls_fnonce to return true, as solution.is_some() is true.

CryZe

comment created time in 4 hours

issue commentrust-analyzer/rust-analyzer

Semantic Highlighting: impl Iterator is considered callable

The Callable modifier comes from https://github.com/rust-analyzer/rust-analyzer/blob/35ed3d2c005fdb0ec9ab78a52b31758bd7de298e/crates/ide/src/syntax_highlighting.rs#L773-L775

CryZe

comment created time in 4 hours

issue commentEmbarkStudios/rust-gpu

Add support for using `glam` crate in shaders

glam uses the sqrt function implemented by libstd. This function calls into libm. The easiest way would be to intercept this call. It has a known symbol name.

repi

comment created time in 5 hours

issue commentrust-lang/rust

-Zno-link is broken

I think DefId should completely be avoided in the input of the linker function. One of the uses if NativeLib in it's foreign_module field. This field doesn't seem to be used by the linking code.

bjorn3

comment created time in 6 hours

push eventheadcrab-rs/headcrab

Takayuki Maeda

commit sha b7cee5ea14646c5492ccf5675c57f5b7e52d9957

remove unused imports

view details

bjorn3

commit sha efb0609892f8cf8960853b5b30526e8f7ee3724c

Merge pull request #129 from TaKO8Ki/remove-unused-imports Remove unused imports

view details

push time in 7 hours

PR merged headcrab-rs/headcrab

Remove unused imports

I've removed unused imports!

+3 -15

0 comment

1 changed file

TaKO8Ki

pr closed time in 7 hours

PullRequestReviewEvent

Pull request review commentEmbarkStudios/rust-gpu

Pin Rust Nightly to 2020-10-25

 #!/usr/bin/env bash-rustup toolchain install nightly --component rust-src rustc-dev llvm-tools-preview+rustup component add rust-src rustc-dev llvm-tools-preview

nit: missing trailing newline

repi

comment created time in 9 hours

Pull request review commentEmbarkStudios/rust-gpu

Pin Rust Nightly to 2020-10-25

 setlocal -rustup toolchain install nightly-2020-10-24 --component rust-src rustc-dev llvm-tools-preview+rustup component add rust-src rustc-dev llvm-tools-preview

nit: missing trailing newline

repi

comment created time in 9 hours

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/compiler-builtins

Set the "asm" feature flag by default

What about naming it no_asm instead? That makes it clear that it isn't just for cg_clif, as other backends may also not support inline asm.

josephlr

comment created time in 9 hours

pull request commentrust-lang/rust

Add cg_clif as optional codegen backend

@rustbot modify labels: -S-waiting-on-author +S-waiting-on-review

bjorn3

comment created time in 11 hours

issue commentdarfink/region-rs

Feature Request: Add support for OpenBSD

Cranelift only uses region::page::size and region::protect. Adding a feature flag for the querying abilities would also be nice for Redox OS.

jesselucas

comment created time in 12 hours

Pull request review commentEmbarkStudios/rust-gpu

Add example to evaluate sky shader on CPU

+use minifb::{Key, Window, WindowOptions};+use rayon::prelude::*;+use spirv_std::{vec2, Vec4};+use std::time::Instant;++fn color_u32_from_vec4(v: Vec4) -> u32 {+    let convert = |f: f32| -> u32 { (f.min(1.0).max(0.0) * 255.0).round() as u32 };++    convert(v.z()) | convert(v.y()) << 8 | convert(v.x()) << 16 | convert(v.w()) << 24+}++fn main() {+    const WIDTH: usize = 1280;+    const HEIGHT: usize = 720;++    let mut window = Window::new(+        "Rust GPU - CPU shader evaluation",+        WIDTH,+        HEIGHT,+        WindowOptions::default(),+    )+    .expect("Window creation failed");++    // Limit to max ~60 fps update rate+    window.limit_update_rate(Some(std::time::Duration::from_micros(16600)));++    let start_time = Instant::now();++    let buffer = (0..WIDTH * HEIGHT)+        .into_par_iter()+        .map(|i| {+            let screen_pos = vec2(+                (i % WIDTH) as f32 / WIDTH as f32 * 2.0 - 1.0,+                (i / HEIGHT) as f32 / HEIGHT as f32 * 2.0 - 1.0,

It took me a while to wrap my head around this, but what happens is the following: The i % WIDTH generates an x coordinate in the range 0..WIDTH, the / WIDTH turns it into the range 0.0 .. 1.0, the * 2.0 - 1.0 then turns it into the range -1.0 .. 1.0. Same for the y coordinate.

repi

comment created time in 12 hours

PullRequestReviewEvent

pull request commentrust-lang/rust

Compile rustc crates with the initial-exec TLS model

Once https://github.com/rust-lang/rust/pull/77975 lands Mode::Codegen shouldn't use this. Also for executables the linker will rewrite it anyway.

joshtriplett

comment created time in 12 hours

pull request commentrust-lang/rust

Add cg_clif as optional codegen backend

Squashed into cf798c1ec65a5ec3491846777f9003fabb881b4a and added subtree in ac4f7deb2f3558d2d923fa6ddcbb7210db9c2d52.

bjorn3

comment created time in 12 hours

push eventbjorn3/rust

bjorn3

commit sha aeecb45bebc26499ba7382627733e2677fab1af6

Preserve the order files are added to archives rust.metadata.bin could have been at the start of an .rlib file confusing ld

view details

bjorn3

commit sha d4ed46fa757d753b64cd45de2604878780d7189a

Merge pull request #495 from bjorn3/use_cg_clif_link Use cg clif link

view details

bjorn3

commit sha 421fe2e982bd6173a17aa850557f031d3e1dfd2c

Update cranelift

view details

bjorn3

commit sha 27ea27e2e3e77f82cc470dd695f54ececa16cb4b

Fix using using the same vtable twice

view details

bjorn3

commit sha f473ba8f87a8397e358a79f8ccae2d944f7bee95

Rustup to rustc 1.36.0-nightly (938d4ffe1 2019-04-27)

view details

dependabot[bot]

commit sha c33d127a59cffa64b9b9096cedd409df01f4f755

Bump cranelift from `4f69c32` to `c0ee30f` Bumps [cranelift](https://github.com/CraneStation/cranelift) from `4f69c32` to `c0ee30f`. - [Release notes](https://github.com/CraneStation/cranelift/releases) - [Commits](https://github.com/CraneStation/cranelift/compare/4f69c32572a13f4ded3b05542abf476d1cd2ead8...c0ee30f9a95bd80bd6485c21bad7e8e0b8c5caf0) Signed-off-by: dependabot[bot] <support@dependabot.com>

view details

dependabot[bot]

commit sha 8de77b90119bb8969b4608760c04f4b8161dcfe0

Merge pull request #511 from bjorn3/dependabot/cargo/cranelift-c0ee30f

view details

dependabot[bot]

commit sha 8fa92b8bb4d457408a1cceae5bcc1ab5f10b8341

Bump libc from 0.2.51 to 0.2.53 (#508) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.51 to 0.2.53. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.51...0.2.53) Signed-off-by: dependabot[bot] <support@dependabot.com>

view details

dependabot[bot]

commit sha bbd83ebf9d91789edba826171fd6a43b6d17aac7

Bump proc-macro2 from 0.4.27 to 0.4.29 (#507) Bumps [proc-macro2](https://github.com/alexcrichton/proc-macro2) from 0.4.27 to 0.4.29. - [Release notes](https://github.com/alexcrichton/proc-macro2/releases) - [Commits](https://github.com/alexcrichton/proc-macro2/compare/0.4.27...0.4.29) Signed-off-by: dependabot[bot] <support@dependabot.com>

view details

bjorn3

commit sha 8598a34e4514e90bf22eba00ec07c6cee5842df7

Rustup to rustc 1.36.0-nightly (a3404557c 2019-05-03)

view details

bjorn3

commit sha 98dae86d214226b2d9bf400bae39f040f279821b

Update cranelift

view details

bjorn3

commit sha 7bf9b8e6e13bdead4217217e8f66cbf0eff414a5

Update gimli

view details

bjorn3

commit sha 80fc7b569ce01da361c160ce98686655fab4aa64

Use crates.io version of ar again

view details

bjorn3

commit sha 97747aa91a731b537251f327cd30924f4aa8d935

Update Cargo.lock

view details

bjorn3

commit sha bb7a990ee790b9063f1c4e0aa7911d618c3e4386

Extract driver.rs

view details

bjorn3

commit sha 2aeffa679a6c9a36459b5aa8d77277e80c17a30c

Rustup to rustc 1.36.0-nightly (cfdc84a00 2019-05-07)

view details

dependabot[bot]

commit sha 82d113cad41cee9ab0e797664b847f6f1791dc80

Bump syn from 0.15.33 to 0.15.34 Bumps [syn](https://github.com/dtolnay/syn) from 0.15.33 to 0.15.34. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/0.15.33...0.15.34) Signed-off-by: dependabot[bot] <support@dependabot.com>

view details

dependabot[bot]

commit sha 6663c9f185de6dfc52942145160f58aa1a2e37bc

Bump serde from 1.0.90 to 1.0.91 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.90 to 1.0.91. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.90...v1.0.91) Signed-off-by: dependabot[bot] <support@dependabot.com>

view details

dependabot[bot]

commit sha 9c638ea8fa80c52cc4c20345e289cb3e595f2d91

Merge pull request #526 from bjorn3/dependabot/cargo/syn-0.15.34

view details

dependabot[bot]

commit sha 031d7284486814b50759e42978884c39e111c8f3

Merge pull request #525 from bjorn3/dependabot/cargo/serde-1.0.91

view details

push time in 12 hours

push eventbjorn3/rustc_codegen_cranelift

bjorn3

commit sha 793d26047f994e23415f8f6bb5686ff25d3dda92

Rustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25)

view details

push time in 12 hours

pull request commentrust-lang/rust

WIP: Compile rustc crates with the initial-exec TLS model

I found -z nodlopen, but it doesn't seem to affect tls storage model. By the way instead of mode != Mode::Std I think it should be mode == Mode::Rustc, so other things don't accidentally get the initial-exec TLS storage model.

joshtriplett

comment created time in 12 hours

pull request commentrust-lang/rust

incr-comp: hash and serialize span end line/column

Regression of up to 3%.

tgnottingham

comment created time in 14 hours

issue commentEmbarkStudios/rust-gpu

Expose GLOps not in std::intrinsics

It should be possible to intercept calls to functions with specific names and instead emit a SPIRV instruction.

khyperia

comment created time in a day

issue commentEmbarkStudios/rust-gpu

Expose GLOps not in std::intrinsics

libstd directly calls the libm functions. Adding an extra intrinsic requires a rustc change to add it to the list of intrinsics of typeck.

khyperia

comment created time in a day

Pull request review commentEmbarkStudios/rust-gpu

Pin Rust Nightly to 2020-10-24

 setlocal -rustup toolchain install nightly --component rust-src rustc-dev llvm-tools-preview+rustup toolchain install nightly-2020-10-24 --component rust-src rustc-dev llvm-tools-preview

Wouldn't rustup component add rust-src rustc-dev llvm-tools-preview automatically install the correct nightly?

repi

comment created time in a day

PullRequestReviewEvent

issue commentrust-analyzer/rust-analyzer

unresolved import: `thiserror::Error`

That is a duplicate of https://github.com/rust-analyzer/rust-analyzer/issues/6038.

bryanburgers

comment created time in a day

issue commentEmbarkStudios/rust-gpu

Rust nightly 2020-10-25 broke build & is not supported

cg_clif has a script that will update rust-toolchain for the latest version, does a cargo clean and remove all old nightly versions at the same time. It also supports commiting with a commit message stating the new rustc version. It may be useful https://github.com/bjorn3/rustc_codegen_cranelift/blob/8ec977e763baee45dbc6b3efd84e96a7e5dc3f91/scripts/rustup.sh (It uses the local time to select the right rustc version, so it may not work of you are not in Europe)

repi

comment created time in a day

Pull request review commentrust-lang/rust

Add lint for panic!("{}")

+use crate::{LateContext, LateLintPass, LintContext};+use rustc_ast as ast;+use rustc_errors::Applicability;+use rustc_hir as hir;+use rustc_middle::ty;+use rustc_parse_format::{ParseMode, Parser, Piece};+use rustc_span::{sym, InnerSpan};++declare_lint! {+    /// The `panic_fmt` lint detects `panic!("..")` with `{` or `}` in the string literal.+    ///+    /// ### Example+    ///+    /// ```rust,no_run+    /// panic!("{}");+    /// ```+    ///+    /// {{produces}}+    ///+    /// ### Explanation+    ///+    /// `panic!("{}")` panics with the message `"{}"`, as a `panic!()` invocation+    /// with a single argument does not use `format_args!()`.+    /// A future version of Rust will interpret this string as format string,+    /// which would break this.+    PANIC_FMT,+    Warn,+    "detect braces in single-argument panic!() invocations",+    report_in_external_macro+}++declare_lint_pass!(PanicFmt => [PANIC_FMT]);++impl<'tcx> LateLintPass<'tcx> for PanicFmt {+    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {+        if let hir::ExprKind::Call(f, [arg]) = &expr.kind {+            if let &ty::FnDef(def_id, _) = cx.typeck_results().expr_ty(f).kind() {+                if Some(def_id) == cx.tcx.lang_items().begin_panic_fn()+                    || Some(def_id) == cx.tcx.lang_items().panic_fn()+                {+                    check_panic(cx, f, arg);+                }+            }+        }+    }+}++fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tcx hir::Expr<'tcx>) {+    if let hir::ExprKind::Lit(lit) = &arg.kind {+        if let ast::LitKind::Str(sym, _) = lit.node {+            let mut expn = f.span.ctxt().outer_expn_data();+            if let Some(id) = expn.macro_def_id {+                if cx.tcx.is_diagnostic_item(sym::std_panic_macro, id)+                    || cx.tcx.is_diagnostic_item(sym::core_panic_macro, id)+                {+                    let fmt = sym.as_str();+                    if !fmt.contains(&['{', '}'][..]) {+                        return;+                    }++                    let fmt_span = arg.span.source_callsite();++                    let (snippet, style) =+                        match cx.sess().parse_sess.source_map().span_to_snippet(fmt_span) {+                            Ok(snippet) => {+                                // Count the number of `#`s between the `r` and `"`.+                                let style = snippet.strip_prefix('r').and_then(|s| s.find('"'));+                                (Some(snippet), style)+                            }+                            Err(_) => (None, None),+                        };++                    let mut fmt_parser =+                        Parser::new(fmt.as_ref(), style, snippet.clone(), false, ParseMode::Format);+                    let n_arguments =+                        (&mut fmt_parser).filter(|a| matches!(a, Piece::NextArgument(_))).count();++                    // Unwrap another level of macro expansion if this panic!()+                    // was expanded from assert!() or debug_assert!().+                    for &assert in &[sym::assert_macro, sym::debug_assert_macro] {+                        let parent = expn.call_site.ctxt().outer_expn_data();+                        if parent+                            .macro_def_id+                            .map_or(false, |id| cx.tcx.is_diagnostic_item(assert, id))+                        {+                            expn = parent;+                        }+                    }++                    if n_arguments > 0 && fmt_parser.errors.is_empty() {+                        let arg_spans: Vec<_> = match &fmt_parser.arg_places[..] {+                            [] => vec![fmt_span],+                            v => v.iter().map(|span| fmt_span.from_inner(*span)).collect(),+                        };+                        cx.struct_span_lint(PANIC_FMT, arg_spans, |lint| {+                            let mut l = lint.build(match n_arguments {+                                1 => "panic message contains an unused formatting placeholder",+                                _ => "panic message contains unused formatting placeholders",+                            });+                            l.note("this message is not used as a format string when given without arguments, but will be in a future Rust version");+                            if expn.call_site.contains(arg.span) {+                                l.span_suggestion(+                                    arg.span.shrink_to_hi(),+                                    "add the missing argument(s)",+                                    ", ...".into(),+                                    Applicability::HasPlaceholders,+                                );+                                l.span_suggestion(+                                    arg.span.shrink_to_lo(),+                                    "or add a \"{}\" format string to use the message literally",+                                    "\"{}\", ".into(),+                                    Applicability::MaybeIncorrect,
                                    Applicability::MachineApplicable,

This preserves the original meaning, even if it may not have been the intended one.

m-ou-se

comment created time in a day

PullRequestReviewEvent

push eventbjorn3/rustc_codegen_cranelift

bjorn3

commit sha 8ec977e763baee45dbc6b3efd84e96a7e5dc3f91

Replace write with write_all

view details

push time in a day

pull request commentrust-lang/cargo

[WIP] mtime+content tracking

For dylibs there is a separate codegen unit for metadata. You can add the symbol there. For executables you can add it to the main shim generation. For rlibs you can add a separate archive member.

gilescope

comment created time in a day

issue commentrust-lang/stdarch

Codegen tests fail on modern x86 CPUs due to `v` prefix

You should not pass -C target-cpu=native when running cargo test.

DevJPM

comment created time in a day

pull request commentrust-lang/rust

[WIP] Content hash support. (See also cargo changes)

So I guess it's all working fine but some optimisation layer is removing it (linker maybe?). I will try and see if I can hint to the linker not to remove it...

This for executables? You may need to do the same as for the gdb debug scripts section. (reference it from the main shim using a volatile load)

https://github.com/rust-lang/rust/blob/17cc9b6256c95c31944591aec683884fead4e3b6/compiler/rustc_codegen_ssa/src/base.rs#L429

gilescope

comment created time in 2 days

Pull request review commentrust-lang/rust

[WIP] Content hash support. (See also cargo changes)

 pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> {     unsafe { ValueIter { cur: llvm::LLVMGetFirstGlobal(llmod), step: llvm::LLVMGetNextGlobal } } } +pub fn svh_symbol_name(tcx: TyCtxt<'_>) -> String {+    format!(+        "rust_svh_{}_{}",+        tcx.original_crate_name(LOCAL_CRATE),+        tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex()

This needs to be crate_hash. crate_disambiguator is passed by cargo using -Cmetadata and doesn't depend on the source code.

gilescope

comment created time in 2 days

PullRequestReviewEvent

issue commentEmbarkStudios/rust-gpu

Add support for using `glam` crate in shaders

Mesa has support for software rendering using the llvmpipes backend. It should be possible to use this for testing.

repi

comment created time in 2 days

Pull request review commentAmanieu/parking_lot

Add winapi srwlock to benchmarks

 path = "src/rwlock.rs" [features] nightly = ["parking_lot/nightly"] deadlock_detection = ["parking_lot/deadlock_detection"]++[target.'cfg(windows)'.dependencies]+winapi = { version = "0.3", features = ["synchapi"] }

nit: missing trailing newline

nico-abram

comment created time in 2 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Implement lazy decoding of DefPathTable during incremental compilation

Huge wins of up to 35% in incremental mode. Slight regression of up to 0.5% in non-incremental mode.

Aaron1011

comment created time in 2 days

issue commentbytecodealliance/wasmtime

Cranelift: Incorrect values with more than 3 return parameters with system_v calling convention.

The three return value case is an extension of the System-V abi, it only gives a verifier error for four or more return values. While this extension is supported by both Cranelift and I think LLVM, it will never be used for #[repr(C)] structs with three register sized elements, as that would be in conflict with the System-V abi. I am pretty sure there is no way to convince rustc to use this extension. You should instead just take an extra argument that points to a place to write the return value to.

chrisvittal

comment created time in 2 days

issue commentbytecodealliance/wasmtime

Tracking issue for booleans

We are currently in the process of switching to a new framework for backends. I am not quite sure what has already been implemented in the new backends and what hasn't.

jyn514

comment created time in 2 days

issue commentrust-analyzer/rust-analyzer

IncorrectCase diagnostic thinks lazy_static refs should be camel cased

lazy_static! creates a type named the same as the static. It uses #[allow(non_camel_case_types)] to suppress the warning for rustc, but rust-analyzer doesn't have support for this.

ArifRoktim

comment created time in 2 days

issue commentbytecodealliance/wasmtime

Cranelift: Incorrect values with more than 3 return parameters with system_v calling convention.

Also using multiple return values to represent returning a tuple struct is not correct in the general case. For the two primitive elements case it happens to be correct on x86_64 with the System-V call conv, but for three or more elements the function in most cases actually takes a pointer to where the struct needs to be stored.

chrisvittal

comment created time in 2 days

issue commentbytecodealliance/wasmtime

Cranelift: Incorrect values with more than 3 return parameters with system_v calling convention.

It isn't allowed to return more than 3 values. This should result in an error when you run the verifier.

chrisvittal

comment created time in 2 days

pull request commentrust-lang/rust

TypeFoldable: take self by value

Slight regression up to 0.6%.

lcnr

comment created time in 2 days

issue commentEmbarkStudios/rust-gpu

cargo build fails on windows

Maybe use #![cfg_attr(target_arch = "spirv"), no_std] at https://github.com/EmbarkStudios/rust-gpu/blob/8681464af7e2500f371e5df6a95691cf29ecd16a/spirv-std/src/lib.rs#L1

That will ensure that any linked dylib will have all dependencies required for the target triple.

khyperia

comment created time in 3 days

issue commentEmbarkStudios/rust-gpu

cargo build fails on windows

Is it accidentally trying to compile the shader for the host too?

khyperia

comment created time in 3 days

Pull request review commentEmbarkStudios/rust-gpu

Add framework for compiler tests

+mod basic;++use lazy_static::lazy_static;+use std::error::Error;+use std::path::{Path, PathBuf};+use std::sync::Mutex;++// Tests need to run serially, since they write project files to disk and whatnot. We don't want to+// create a new temp dir for every test, though, since then every test would need to build libcore.+// We could require the user to pass --thread-count 1 to cargo test, but that affects other tests.+// So make a global mutex wrapping every test.+lazy_static! {+    static ref GLOBAL_MUTEX: Mutex<()> = Mutex::new(());+}++static CARGO_TOML: &str = r#"[package]+name = "test-project"+version = "0.1.0"+authors = ["Embark <opensource@embark-studios.com>"]+edition = "2018"++[lib]+crate-type = ["dylib"]++[dependencies]+spirv-std = { path = "../../spirv-std" }++[workspace]+"#;++static SRC_PREFIX: &str = r#"#![no_std]+#![feature(lang_items, register_attr)]+#![register_attr(spirv)]+use core::panic::PanicInfo;+use spirv_std::*;+#[panic_handler]+fn panic(_: &PanicInfo) -> ! {+    loop {}+}+#[lang = "eh_personality"]+extern "C" fn rust_eh_personality() {}

You should be able to avoid this if you pass -Cpanic=abort to rustc.

khyperia

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentEmbarkStudios/rust-gpu

WGPU example

 [workspace] members = [     "examples/example-runner",+	"examples/wgpu-example-runner",
    "examples/wgpu-example-runner",

nit: you used a tab instead of four spaces like the rest of this file.

VZout

comment created time in 3 days

PullRequestReviewEvent

pull request commentEmbarkStudios/rust-gpu

Fix translation from AtomicOrdering to MemorySemantics

There are intrinsics for the unordered versions of atomic operations, but they aren't used by Atomic*.

khyperia

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentEmbarkStudios/rust-gpu

Fail unimplemented intrinsics instead of incorrect behavior

 impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {     simple_uni_op! {neg, s_negate}     simple_uni_op! {fneg, f_negate} +    fn exactudiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value {+        let result = self.udiv(lhs, rhs);+        self.zombie(result.def, "exactudiv is not supported yet");

You don't need a zombie here. exactudiv is the same as udiv except that it is UB when there is a remainder and in a few other cases. It is fine to just ignore the UB. You may want to add a FIXME to take advantage of the UB in the future.

khyperia

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/stdarch

Run CI for i686-pc-windows-msvc

@and-arch You are listed in the watch list of this repo. If you don't want to get emails for notifications on this repo, you should unwatch it. On the top left corner of all pages of this repo there are three buttons. One to watch/unwatch, one to star/unstar and one to fork. image

makotokato

comment created time in 4 days

Pull request review commentEmbarkStudios/rust-gpu

Fix translation from AtomicOrdering to MemorySemantics

 fn memset_dynamic_scalar( }  impl<'a, 'tcx> Builder<'a, 'tcx> {+    fn ordering_to_semantics_def(&self, ordering: AtomicOrdering) -> SpirvValue {+        let mut invalid_seq_cst = false;+        let semantics = match ordering {+            AtomicOrdering::NotAtomic => MemorySemantics::NONE,+            AtomicOrdering::Unordered => MemorySemantics::NONE,+            AtomicOrdering::Monotonic => MemorySemantics::NONE,+            AtomicOrdering::Acquire => MemorySemantics::MAKE_VISIBLE | MemorySemantics::ACQUIRE,+            AtomicOrdering::Release => MemorySemantics::MAKE_AVAILABLE | MemorySemantics::RELEASE,+            AtomicOrdering::AcquireRelease => {+                MemorySemantics::MAKE_AVAILABLE+                    | MemorySemantics::MAKE_VISIBLE+                    | MemorySemantics::ACQUIRE_RELEASE+            }+            AtomicOrdering::SequentiallyConsistent => {+                let emit = self.emit();+                let memory_model = emit.module_ref().memory_model.as_ref().unwrap();+                if memory_model.operands[1].unwrap_memory_model() == MemoryModel::Vulkan {+                    invalid_seq_cst = true;

It is simpler to directly return the zombie here I think.

khyperia

comment created time in 4 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

This is a slight speedup.

wesleywiser

comment created time in 4 days

issue commentflamegraph-rs/flamegraph

Example usage with Criterion?

You will need to add the following to Cargo.toml I think:

[profile.bench]
debug = false
deklanw

comment created time in 4 days

pull request commentrust-lang/rust

WIP: Compile rustc crates with the initial-exec TLS model

If you tell the linker about the storage model instead of LLVM it should rewrite all TLS accesses to use that storage model I think. You could do that using a build.rs for rustc_driver. That will apply it to exactly the dylib that it should be applied to.

joshtriplett

comment created time in 4 days

issue closedEmbarkStudios/rust-gpu

Use tcx.sess.check_name to avoid unused attribute lint for #[spriv] attributes

https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/struct.Session.html#method.check_name

The docs say that tools shouldn't use it, but that was probably written when #![register_attr] didn't exist yet.

closed time in 4 days

bjorn3

issue commentEmbarkStudios/rust-gpu

Use tcx.sess.check_name to avoid unused attribute lint for #[spriv] attributes

In PM @khyperia said this doesn't work as the lint is fired before the codegen backend runs.

bjorn3

comment created time in 4 days

issue openedEmbarkStudios/rust-gpu

Use tcx.sess.check_name to avoid unused attribute lint for #[spriv] attributes

https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/struct.Session.html#method.check_name

The docs say that tools shouldn't use it, but that was probably written when #![register_attr] didn't exist yet.

created time in 4 days

issue openedEmbarkStudios/rust-gpu

ordering_to_semantics not correctly implemented

https://github.com/EmbarkStudios/rust-gpu/blob/f4f103197694290c469ad00d8f156ea7d0bfc292/rustc_codegen_spirv/src/builder/builder_methods.rs#L55-L67

According to https://www.khronos.org/blog/comparing-the-vulkan-spir-v-memory-model-to-cs the following must change:

  • Acquire must use MakeVisible | Acquire
  • Release must use MakeAvailable | Release
  • AcqRel must use MakeAvailable | MakeVisible | AcquireRelease
  • According to the SPIR-V specification SeqCst must not be used for Vulkan. https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_memory_semantics__id_a_memory_semantics_lt_id_gt

    If the declared memory model is Vulkan, SequentiallyConsistent must not be used.

created time in 4 days

issue openedEmbarkStudios/rust-gpu

Prefer not implementing intrinsics in a way that breaks in edge cases

For example saturating_add isn't implemented in a saturating way:

https://github.com/EmbarkStudios/rust-gpu/blob/f4f103197694290c469ad00d8f156ea7d0bfc292/rustc_codegen_spirv/src/builder/intrinsics.rs#L88-L97

This is more of a lesson I learnt the hard way than an issue with rust-gpu itself. While it may seem like a good idea at first to get it quickly working, it will backfire in the long term. I have spent quite a lot of time debugging miscompilations in cg_clif caused by exactly this kind of shortcuts. At minimum I think you should add a FIXME every time you add such a shortcut.

created time in 4 days

pull request commentrust-lang/backtrace-rs

Enable Mach-O on iOS in gimli.

I think watchos and all other operating systems of apple should be included too.

cutsoy

comment created time in 4 days

pull request commentrust-lang/rfcs

RFC: -C export-executable-symbols

Would this allow us to write integration tests against an exe? Currently we can only do it against libs. (I.e. tests in the tests dir). This leads to a lot of exes being changed into libs just for test purposes...

That would require including crate metadata in the executable. This may also be useful for Headcrab to compile rust code against the debugged executable and inject it. for a counter to the print command of gdb and lldb that accepts arbitrary rust code. DWARF debuginfo doesn't provide enough information for arbitrary rust code. Only for the tiny subset of rust that gdb and lldb accept.

MaulingMonkey

comment created time in 4 days

issue commentrust-lang/rust

All stacktrace lines are "<unknown>" on FreeBSD

For iOS it may or may not work to extend the condition at https://github.com/rust-lang/backtrace-rs/blob/8eee2e473e71e659cbd5d32ee78aaf42e8b75752/src/symbolize/gimli.rs#L204 to include iOS too.

stevebob

comment created time in 4 days

issue commentrust-lang/rust

All stacktrace lines are "<unknown>" on FreeBSD

Likely caused by #74682. (switching from libbacktrace to gimli)

It seems that native_libraries is not implemented for FreeBSD: https://github.com/rust-lang/backtrace-rs/blob/8eee2e473e71e659cbd5d32ee78aaf42e8b75752/src/symbolize/gimli.rs#L435-L436 I think this means that it can't find the debuginfo for any libraries and the current executable.

stevebob

comment created time in 4 days

push eventbjorn3/rustc_codegen_cranelift

bjorn3

commit sha 8dc71a419e2db70daa8cb8c5e553bfb4376c4f6b

Rustup to rustc 1.49.0-nightly (1eaadebb3 2020-10-21)

view details

bjorn3

commit sha d2b8406c200430fded9a981d46e08e415daa850a

Remove unused trap_unimplemented_ret_value

view details

push time in 4 days

issue commentrust-lang/miri

No notification for cronjobs

Yes, I get a notification for a failed pr labeler cronjob on my wasmtime fork every so often. https://github.com/bjorn3/wasmtime/actions?query=is%3Afailure

RalfJung

comment created time in 4 days

issue commentrust-lang/miri

No notification for cronjobs

I enabled both web and email notifications for failed github actions runs. I haven't ever had a problem with it. Maybe it has to do something with miri being part of an organization, while cg_clif is part of my user. I haven't ever got a notification for rust-analyzer either. I am a triage team member and I am watching the main rust-analyzer repo.

RalfJung

comment created time in 4 days

pull request commentbytecodealliance/wasmtime

machinst x64: New backend unwind

macOS has both DWARF unwinding and compact unwind info. Both of which can be used with the same SystemV calling convention.

yurydelendik

comment created time in 5 days

issue commentrust-analyzer/rust-analyzer

IncorrectCase doesn't catch patterns in function parameters

const INPUT_ONE: () = ();
const INPUT_TWO: () = ();

pub fn func((INPUT_ONE, INPUT_TWO): ((), ())) {}

is valid rust and doesn't give a warning with rustc either. INPUT_ONE and INPUT_TWO match () here. This means that implementing this lint in this case will have to resolve identifiers, which can slow it down and will give spurious warnings on incomplete code elsewhere.

ArifRoktim

comment created time in 5 days

pull request commentrust-analyzer/rust-analyzer

Don't supply a textmate grammar for Rust

The textmate grammar was introduced to minimize the difference in syntax highlighting before and after semantic highlighting takes effect.

benesch

comment created time in 5 days

pull request commentrust-lang/rust

rustc_mir: track inlined callees in SourceScopeData.

https://github.com/rust-lang/rustc-perf/blob/056d7a2bbdeaf1e23d598a9548ccf3c3f68c15c9/collector/benchmarks/ctfe-stress-4/src/lib.rs

ctfe-stress-4 uses const fn which behaves similar to #[inline] I think.

The slight slowdowns don't reflect in the self-profile data, so I don't know where they're coming from.

I saw eval_to_allocation_raw for ctfe-stress-4.

eddyb

comment created time in 5 days

issue commentdarlinghq/darling

Running minimal gui app doesn't works

roblox is not a minimal GUI app.

epiixgd76

comment created time in 5 days

Pull request review commentkkawakam/rustyline

Ignore EINTR while polling

 impl PosixRawReader {      fn poll(&mut self, timeout_ms: i32) -> ::nix::Result<i32> {         let mut fds = [poll::PollFd::new(STDIN_FILENO, PollFlags::POLLIN)];-        poll::poll(&mut fds, timeout_ms)+        let r = poll::poll(&mut fds, timeout_ms);+        match r {+            Ok(_) => r,+            Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {+                if SIGWINCH.load(atomic::Ordering::Relaxed) {+                    r+                } else {+                    Ok(0) // Ignore EINTR while polling

stty sane enables BRKINT. Also with a shell I am not only referring to something like bash, but also repls like python, node, gdb, ...

gwenn

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentrust-lang/triagebot

Add github token check

 impl RequestSend for RequestBuilder {     } } +fn validate_token(t: &str) -> bool {+    t.chars().all(|char| char.is_digit(16))+}+ /// Finds the token in the user's environment, panicking if no suitable token /// can be found. pub fn default_token_from_env() -> String {-    match std::env::var("GITHUB_API_TOKEN") {-        Ok(v) => return v,-        Err(_) => (),-    }+    let token = match std::env::var("GITHUB_API_TOKEN") {+        Ok(v) => v,+        Err(_) => match get_token_from_git_config() {+            Ok(v) => v,+            Err(_) => {+                panic!("Could not find token in GITHUB_API_TOKEN or .gitconfig/github.oath-token")
                panic!("Could not find token in GITHUB_API_TOKEN or .gitconfig/github.oauth-token")
apiraino

comment created time in 5 days

PullRequestReviewEvent

pull request commentrust-lang/miri

Enable `backtrace` feature in the generated `Xargo.toml`

On Windows a system library is used. Because miri doesn't perform any linking, it is fine if that system library turns out to be missing. For unix backtrace-rs used to use libbacktrace, which gets compiled in build.rs, thus requiring a C toolchain for the target platform. Since the switch to gimli it only depends on libunwind for unwinding, which is a system library and also not used for miri anyway.

Aaron1011

comment created time in 6 days

pull request commentrust-lang/miri

Enable `backtrace` feature in the generated `Xargo.toml`

(Or does it avoid even linking in the debug symbol parsing when Miri is used?)

The debuginfo handling has been replaced by addr2line on non-Windows systems by default for a while now. (https://github.com/rust-lang/backtrace-rs/pull/324) One of the reasons for this switch was:

Secondarily, it means this library no longer needs a C compiler. Being an all-Rust crate generally makes it much easier to cross-compile, port, etc.

Aaron1011

comment created time in 6 days

issue commentbytecodealliance/wasmtime

Too many raw_bitcasts in SIMD code

Currently many instructions are both scalar and vector instructions at the same time. For example iadd. Adding a Laneage argument would add unnecessary noise when using scalars only.

abrown

comment created time in 6 days

issue commentrust-lang/rust

Backtrace rendering inconsistent between `std::backtrace` and panics

The panic version doesn't require capturing and resolving all frames in advance. This is faster and would be essential for displaying a backtrace in case of OOM or stackoverflow if we want to do thzt in the future because it requires much less memory.

RalfJung

comment created time in 6 days

pull request commentrust-lang/rust

rustc_mir: track inlined callees in SourceScopeData.

A slight (<0.4%) slowdown for many benchmarks with a outliers of 0.6% (full) / 1.0% (incr-full) for the ctfe-stress-4 variants.

eddyb

comment created time in 6 days

issue commentbytecodealliance/wasmtime

Too many raw_bitcasts in SIMD code

Replacing NxM with V128 would require a new variant of many instructions for every lane size. The current design allows using the same iadd instruction for every integer type both scalar and vector. It is also useful for typechecking CLIF derived from rust, as rust doesn't allow mixing vector types without an explicit transmute.

abrown

comment created time in 6 days

Pull request review commentkkawakam/rustyline

Ignore EINTR while polling

 impl PosixRawReader {      fn poll(&mut self, timeout_ms: i32) -> ::nix::Result<i32> {         let mut fds = [poll::PollFd::new(STDIN_FILENO, PollFlags::POLLIN)];-        poll::poll(&mut fds, timeout_ms)+        let r = poll::poll(&mut fds, timeout_ms);+        match r {+            Ok(_) => r,+            Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {+                if SIGWINCH.load(atomic::Ordering::Relaxed) {+                    r+                } else {+                    Ok(0) // Ignore EINTR while polling

This doesn't offer any way to get the old behavior back. The old behavior os useful for shells where ctrl-c would result in EINTR. It should cancel the input in that case.

gwenn

comment created time in 6 days

PullRequestReviewEvent

pull request commentrust-lang/rust

always try inlining functions which do not call other functions

^ cc @pietroalbini

lcnr

comment created time in 6 days

issue commentrust-analyzer/rust-analyzer

Latest nightly seems to ignore semantic highlighting settings

Interesting. It seems that the enum rule only matches enum Name and interprets the part between { and } as if it isn't an enum declaration. This means that tuple variants get interpreted as function calls.

aloucks

comment created time in 6 days

issue commentrust-analyzer/rust-analyzer

Latest nightly seems to ignore semantic highlighting settings

Enum variants should always start with a capital first letter. (There is a lint for that) This means they should always get the type textmate scope.

aloucks

comment created time in 6 days

more