Skip to content

Instantly share code, notes, and snippets.

View DiamondLovesYou's full-sized avatar

Richard Diamond DiamondLovesYou

View GitHub Profile
@DiamondLovesYou
DiamondLovesYou / codegen.ll
Last active October 23, 2018 10:12
LLVM module for a JIT-ed Rust function (with addrspacecast optimizations)
; ModuleID = 'jit-methods.7rcbfp3g-cgu.0'
source_filename = "jit-methods.7rcbfp3g-cgu.0"
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
target triple = "amdgcn-amd-amdhsa-amdgiz"
%"ndarray::ArrayBase<ndarray::ViewRepr<&mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>>" = type { [0 x i8], %"ndarray::ViewRepr<&mut f32>", [0 x i8], float*, [0 x i64], %"ndarray::dimension::dim::Dim<[usize; 1]>", [0 x i64], %"ndarray::dimension::dim::Dim<[usize; 1]>", [0 x i64] }
%"ndarray::ViewRepr<&mut f32>" = type { [0 x i8], %"core::marker::PhantomData<&mut f32>", [0 x i8] }
%"core::marker::PhantomData<&mut f32>" = type {}
%"ndarray::dimension::dim::Dim<[usize; 1]>" = type { [0 x i64], [1 x i64], [0 x i64] }
%"hsa_rt_sys::hsa_kernel_dispatch_packet_s" = type { [0 x i16], i16, [0 x i16], i16, [0 x i16], i16, [0 x i16], i16, [0 x i16], i16, [0 x i16], i16, [0 x i16], i32, [0 x i32],
@DiamondLovesYou
DiamondLovesYou / mir-hsa-ndarray-example.ll
Created June 16, 2018 06:37
Demonstration of single source Rust support and partial support for AMDGPU codegen
This file has been truncated, but you can view the full file.
adding dylibs in search path /opt/rocm/hsa/lib
adding dylibs in search path /home/dick/workspace/src/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/
adding dylibs in search path /home/dick/workspace/src/mir-hsair/target/debug
parsing metadata from rust_metadata_log_5b713437c8bd71485412c2ad7874fb88
parsing metadata from rust_metadata_kernel32_d224557aec71859f9ad849f673c5d29
parsing metadata from rust_metadata_utf8_ranges_819c6f66c9b90b9ec3a987f990a570da
parsing metadata from rust_metadata_rand_5d9e49578401daaaf4fd86155ed6d9d4
parsing metadata from rust_metadata_winapi_101b2d8b3016f3822837d81a88441bc6
parsing metadata from rust_metadata_num_traits_e51a54b8a55909bc155ac0a207831e7b
parsing metadata from rust_metadata_num_complex_84760e8bde315f133a33cbb5d43cefd1
@DiamondLovesYou
DiamondLovesYou / .config
Last active March 27, 2018 20:04
kfd2kgd: amdgpu: failed to validate PT BOs
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.16.0-rc1 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@DiamondLovesYou
DiamondLovesYou / e415.md
Created October 25, 2016 15:35
Problem 4.15

Problem 4.15

e415.m

abserr = 1e-8;
relerr = 1e-6;

figure;
fplot(@e415f);

Problem 4.13

e413.m

abserr = 1e-8;
relerr = 1e-6;

figure;
fplot(@(x) cot(x) - (x^2 - 1) / (2*x), [0 10, -10, 10]);
function [ ] = E4_10helper( function_file )
%E4_10HELPER Holds common code used in each part.
global nfeval
b = 1;
c = 0;
abserr = 1e-8;
relerr = 1e-6;
A = [
0.172 0.013 0.144;
0.368 0.681 0.271;
0.099 0.510 0.329;
];
[A2, success, pivots, cond_num] = Factor(A);
assert(success == 0, 'failed to factor A');

Exercise2_16.m

A = [
    0.473 -0.115 0;
    0.731 -0.391 0.267;
    0     -0.782 0.979;

Exercise2_15.m

v = 50;
A = [
    11 -5 0 0 0 -1;
    -20 41 -15 0 -6 0;
    0 -3 7 -4 0 0;
    0 0 -1 2 -5 0;
 0 -3 0 -10 28 -15;