Skip to content

Instantly share code, notes, and snippets.

gnzlbg gnzlbg

Block or report user

Report or block gnzlbg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gnzlbg
gnzlbg / bfloat16.md
Last active Apr 25, 2019
concerns bfloat16
View bfloat16.md

Add f16b floating-point type for native support of bfloat16

I was asked to properly write my “concerns” here, so these are my concerns in the most constructive way I found to phrase them.

  • concern: llvm-bfloat16

This text claims that LLVM will add a native type for bfloa16. The claim is not supported in the text (e.g. no links to mailing list threads of people working or discussing this). The text should either support the claim or justify the native type in a universe where that never happens.

  • concern: unspecified-abi-issues
@gnzlbg
gnzlbg / pointer_place.md
Created Mar 18, 2019
RFC for directly creating a pointer to a place
View pointer_place.md

Summary

There is currently no way to create a raw pointer to a place. This pre-RFC adds support for it to the language.

Motivation

Verbosity of FFI code dealing with raw pointers

A lot of Rust FFI code reads:

View build_plan.json
{
"invocations": [
{
"package_name": "libc",
"package_version": "0.2.48",
"target_kind": [
"custom-build"
],
"kind": "Host",
"deps": [],
View summary.md

So @eddyb and me talked about this, and this comment summarizes that.

@eddyb proposes a bench_input function with the operational semantics of the identity function, that the optimizer is encouraged / hinted to treat as an unknown pure function (think extern { const fn bench_input<T>(T) -> T; }).

That is, the statement bench_input(expr); can be completely optimized away. Given:

let mut v = Vec::with_capacity(1);
v.push(1);
let v = bench_input(v); 
@gnzlbg
gnzlbg / packed_simd_wrapping_div.md
Last active Feb 8, 2019
Issue while implementing wrapping_div_unchecked in packed_simd
View packed_simd_wrapping_div.md

I have one example from packed_simd, where I want to implement vertical (lane-wise) division for packed SIMD vectors (repr(simd)). The Intel SVML (Short-Vector Math Library) exposes these with the _mm_div_ep{i,u}{lane_bitwidth} APIs.

I've implemented two functions for integers:

impl Simd<[T; N]> where T: Signed | Unsigned {
    pub fn wrapping_div(self, other: Self) -> Self {
        assert!(!other.eq(Self::splat(0)).any(),
                     "division by zero: `{:?} / {:?}`", self, other);
        unsafe { intrinsic::wrapping_div(self, other) }
View setlongjmp_draft.md

Proposal:

Add setjmp and longjmp with the following semantics:

pub type JmpBuf = <implementation-defined>;

/// Saves the current execution context into `env`. If `longjmp(env, val)` is used 
/// to restore execution at this call site, this function returns `val`. Otherwise, 
/// it returns `0`. 
View gist:c1ec23b8d2ed96a156334461d79619ba
[2018-12-28T12:21:14Z DEBUG bindgen] Trying to find clang with flags: ["-D__SSE2__"]
[2018-12-28T12:21:17Z DEBUG bindgen] Found clang: Clang { path: "/usr/bin/clang", version: Some(CXVersion { Major: 10, Minor: 0, Subminor: 0 }), c_search_paths: Some(["/usr/local/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", "/usr/include", "/System/Library/Frameworks", "/Library/Frameworks"]), cpp_search_paths: Some(["/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1", "/usr/local/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", "/usr/include", "/System/Library/Frameworks", "/Library/Frameworks"]) }
[2018-12-28T12:21:17Z DEBUG bindgen] Fixed-up opti
View log.txt
This file has been truncated, but you can view the full file.
Timestamp Thread Type Activity PID TTL
2018-12-13 14:46:34.198610+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198692+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198778+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.206097+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:36.082382+0100 0xdea6 Activity 0xe80f 107 0 locationd: CL: kCLConnectionMessageWatchdog
View gist:0d2bc4170db2fa8e5757e6a7b50ace55
This file has been truncated, but you can view the full file.
Timestamp Thread Type Activity PID TTL
2018-12-13 14:46:34.198610+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198692+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198778+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.206097+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:36.082382+0100 0xdea6 Activity 0xe80f 107 0 locationd: CL: kCLConnectionMessageWatchdog
View gist:97ad1308aa884e537970a84320fd9ea9
This file has been truncated, but you can view the full file.
Timestamp Thread Type Activity PID TTL
2018-12-13 14:46:34.198610+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198692+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.198778+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:34.206097+0100 0x293 Default 0x0 91 0 diskarbitrationd: [com.apple.DiskArbitration.diskarbitrationd:default] <private>
2018-12-13 14:46:36.082382+0100 0xdea6 Activity 0xe80f 107 0 locationd: CL: kCLConnectionMessageWatchdog
You can’t perform that action at this time.