Skip to content

Instantly share code, notes, and snippets.

View dadeba's full-sized avatar

N.Nakasato dadeba

  • University of Aizu
  • Japan
View GitHub Profile
@dadeba
dadeba / FPMUL.v
Last active August 29, 2015 14:08
generated VerilogHDL module
module FPMUL(
input [31:0] io_x,
input [31:0] io_y,
output[31:0] io_z
);
wire[31:0] res;
wire[31:0] T0;
wire[31:0] res_normal;
wire[30:0] T1;
@dadeba
dadeba / FPMUL.scala
Last active August 29, 2015 14:08
parameterized FPMUL in Chsel
trait FPBASE {
val nbit = 32
val nman = 23
val nexp = nbit-nman-1
def mask(x:Int):UInt = UInt((0x1 << x) - 0x1)
def check_zero(x:UInt):Bool = (x === UInt(0))
def man(x:UInt):UInt = mask(nman+1) & (x | UInt(0x1 << nman))
def sign(x:UInt):UInt = x(nbit-1)
def exp(x:UInt):UInt = x(nbit-2,nbit-nexp-1)
def extract(x:UInt): (UInt, UInt, UInt) = (sign(x), exp(x), man(x))
#define READONLY_P const * restrict
__kernel
void
grav1(
__global float4 READONLY_P x,
__global float4 READONLY_P y,
__global float4 READONLY_P z,
__global float4 READONLY_P m,
__global float4 *ax,
__global float4 *ay,
__kernel void templateKernel(__global unsigned int * output,
__global unsigned int * input,
const unsigned int multiplier)
{
uint tid = get_global_id(0);
output[tid] = input[tid] * multiplier;
}
#!/bin/bash
disable_proxy()
{
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
echo "SOCKS proxy disabled."
}
trap disable_proxy INT
sudo networksetup -setsocksfirewallproxy Wi-Fi localhost 8888
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
@dadeba
dadeba / wav.jl
Last active August 29, 2015 14:07
const hz = 44100 :: Int64
function save_wav_file(fn::String, wav_array::Vector)
len = length(wav_array)
pcm = uint16(1);
channel = uint16(1);
bit_s = uint16(16);
byte_s = uint16(bit_s/8 * channel);
samp_ps = uint32(hz);
__kernel void templateKernel(
__global uint8* xx,
__global uint8* yy,
__global uint8* zz,
__global uint8* ww,
__global uint8* res,
const int n_loop
)
{
uint tid = get_global_id(0);
@dadeba
dadeba / error
Created July 18, 2014 11:57
errors in dmesg when running a benchmark on Beignet 0.9.2
[13369.005426] [drm] stuck on render ring
[13369.005430] [drm] GPU crash dump saved to /sys/class/drm/card0/error
[13369.005431] [drm] GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.
[13369.005431] [drm] Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel
[13369.005432] [drm] drm/i915 developers can then reassign to the right component if it's not a kernel issue.
[13369.005433] [drm] The gpu crash dump is required to analyze gpu hangs, so please always attach it.
[13369.007876] [drm:i915_set_reset_status] *ERROR* render ring hung inside bo (0x13561000 ctx 1) at 0x13561100
[13377.990180] [drm] stuck on render ring
[13377.990235] [drm:i915_set_reset_status] *ERROR* render ring hung inside bo (0x13581000 ctx 1) at 0x13581100
[13377.990237] [drm:i915_context_is_banned] *ERROR* context hanging too fast, declaring banned!
@dadeba
dadeba / gist:a3fa8d35cf8bf1aaa01b
Created July 18, 2014 09:55
CLInfo log for Beignet 0.9.2
iris[~] CLInfo [18:54]
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 beignet 0.9.2
Platform Name: Intel Gen OCL Driver
Platform Vendor: Intel
Platform Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_icd
Platform Name: Intel Gen OCL Driver
.file "/tmp/7e04f41d-6a01-45b6-b3ce-d4c2404bd6dd.TMP"
.text
.globl _Z12native_rsqrtDv8_f
.align 16, 0x90
.type _Z12native_rsqrtDv8_f,@function
_Z12native_rsqrtDv8_f: # @_Z12native_rsqrtDv8_f
# BB#0:
vrsqrtps YMM0, YMM0
ret
.Ltmp0: