Skip to content

Instantly share code, notes, and snippets.

@nomaddo
nomaddo / backproweights.cl.s
Created March 28, 2018 13:20
The output of backproweights.cl
// Module with 1 kernels, global data with 0 words (64-bit each), starting at offset 1 words and 0 words of stack-frame
// Kernel 'backprop_floats' with 2305 instructions, offset 2, with following parameters: float learningRateMultiplier (4 B, 1 items), int batchSize (4 B, 1 items), __global const float* gradOutput (4 B, 1 items), __global const float* images (4 B, 1 items), __global out float* gradWeights (4 B, 1 items) (lSize, lids, gidX, offX)
// label: %start_of_function
or r1, unif, unif
or ra1, unif, unif
or r0, unif, unif
or r2, unif, unif
or ra14, unif, unif
or ra13, unif, unif
or ra12, unif, unif
@nomaddo
nomaddo / default.s
Created March 27, 2018 11:12
BackpropWeightsScratchLarge.cl.s (optimized)
// Module with 1 kernels, global data with 0 words (64-bit each), starting at offset 1 words and 0 words of stack-frame
// Kernel 'backprop_floats_withscratch_dobias_striped' with 2502 instructions, offset 2, with following parameters: float learningRateMultiplier (4 B, 1 items), int batchSize (4 B, 1 items), __global const float* gradOutput (4 B, 1 items), __global const float* images (4 B, 1 items), __global out float* gradWeights (4 B, 1 items), __local out float* _errorStripe (4 B, 1 items), __local out float* _imageStripe (4 B, 1 items) (lSize, lids, gidX)
// label: %start_of_function
or rb13, unif, unif
or rb21, unif, unif
or r2, unif, unif
or rb11, unif, unif
or rb12, unif, unif
or rb7, unif, unif
or rb8, unif, unif
@nomaddo
nomaddo / hoge.cpp
Last active March 9, 2018 14:07
vtableできないっぽい?
/*
hoge.cpp: In function ‘int main()’:
hoge.cpp:35:37: warning: dynamic_cast of ‘Base b’ to ‘class A*’ can never succeed
if (auto x = dynamic_cast<A*>(&b))
*/
#include <iostream>
class Base {
public:
// Module with 1 kernels, global data with 0 words (64-bit each), starting at offset 1 words and 0 words of stack-frame
// Kernel 'sum_f16', offset 2, with following parameters: __global float* a (4 B, 1 items), __global float* b (4 B, 1 items), __global float* c (4 B, 1 items)
or -, unif, unif
or r1, unif, unif
or ra4, unif, unif
or -, unif, unif
or -, unif, unif
or -, unif, unif
or r0, unif, unif
or -, unif, unif
@nomaddo
nomaddo / add.py
Last active December 11, 2017 06:39
Addition from two arrays
# see https://github.com/nineties/py-videocore
#
# pi@nomaddo:~/py-videocore$ sudo python add.py 40960
# threads: 12
# numpy: 0.0107 sec, 46.0525 Mflops
# GPU: 0.0050 sec, 99.2960 Mflops
#
# pi@nomaddo:~/py-videocore$ sudo python add.py 20480
# threads: 12
# numpy: 0.0054 sec, 45.1429 Mflops
@nomaddo
nomaddo / sum.s
Created December 7, 2017 07:12
output
// Module with 1 kernels, global data with 0 words (64-bit each), starting at offset 1 words and 0 words of stack-frame
// Kernel 'add', offset 2, with following parameters: __global float* a (4 B, 1 items), __global float* b (4 B, 1 items)
or -, unif, unif
or r1, unif, unif
or ra3, unif, unif
or -, unif, unif
or -, unif, unif
or -, unif, unif
or r0, unif, unif
or -, unif, unif
@nomaddo
nomaddo / c2.s
Created May 31, 2017 15:43
分岐命令の実行時間 => 3.1s
.global main
.type main, %function
main:
push {r3, lr}
bl test
mov r0, #0
pop {r3, pc}
.global test
.type test, %function
@nomaddo
nomaddo / voidtype.c
Created January 8, 2017 14:17
typedef struct t t; みたいな宣言の意味; 同じデータ構造なんだけど、名前を変えて取り違えたときに警告を出すため
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#define dfunc(f) ((void (void *)) f) \
typedef struct set_t {
int cap;
int num;
void ** t;
@nomaddo
nomaddo / mparse-test.ml
Last active June 8, 2016 15:20
mparseで初パーサーコンビねーた。
(* ocamlfind ocamlopt -package mparser -linkall -linkpkg mparser-test.ml *)
(* どんどんひどくなっていっている *)
(* ./a.out "if 0 then 1 else 2" の結果は…… StackOverFlow*)
open MParser
let decimal =
many_chars digit |>> int_of_string |>> (fun i -> `Int i)
let space =
@nomaddo
nomaddo / testjava.ml
Created June 18, 2015 10:26
ocamljavaの例
(* ocamljava -o caml.jar -runtime-parameter runtime-lock=off -I +concurrent -I +javalib javalib.cmja -java-extensions concurrent.cmja unix.cmja ./testjava.ml *)
open JavaPervasives
let size = 1000000
let a = Array.make size 100
let rec tarai x y z =
if x <= y then y