Skip to content

Instantly share code, notes, and snippets.

Siddharth bollu

Block or report user

Report or block bollu

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
View complete-code.c
// Generated by the Tensor Algebra Compiler (tensor-compiler.org)
// taco "x(i)=y(i)+z(i)" -f=x:d:0 -f=y:d:0 -f=z:d:0 -write-source=taco_kernel.c -write-compute=taco_compute.c -write-assembly=taco_assembly.c
#ifndef TACO_C_HEADERS
#define TACO_C_HEADERS
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <complex.h>
#define TACO_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
View coro-cps.ll
; Emulating cps call using LLVM Coroutines
; RUN: opt coro-cps.ll -O2 -enable-coroutines -S
define void @f(i32 %arg) {
entry:
%bar.ret.addr = alloca i32
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
%size = call i32 @llvm.coro.size.i32()
%alloc = call i8* @malloc(i32 %size)
%hdl = call noalias i8* @llvm.coro.begin(token %id, i8* %alloc)
@bollu
bollu / Bytes.hs
Last active Jun 7, 2019
Swiss army knife when debugging low-level bit manipulation
View Bytes.hs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Bytes where
import Prelude hiding ((>>))
data Endian = Big | Little deriving(Eq, Ord)
data Interp = Signed | Unsigned deriving(Eq, Ord, Show)
instance Show Endian where
show Little = "L hi<-lo"
View linker-error-asterius
╭─bollu@strangeattractor ~/work/asterius/asterius/rts ‹june-2-pass-numrun012-on-top-of-cgrun044*›
╰─$ stack build && stack test asterius:ghc-testsuite --test-arguments=" -p FloatFnInverses --timeout 30" ; cat /home/bollu/work/asterius/asterius/test-report.csv
Building all executables for `asterius' once. After a successful build of all of them, only specified executables will be rebuilt.
asterius-0.0.1: build (lib + exe)
Log files have been written to: /home/bollu/work/asterius/.stack-work/logs/
-- While building package asterius-0.0.1 using:
/home/bollu/work/asterius/asterius/.stack-work/dist/x86_64-linux/Cabal-3.0.0.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-3.0.0.0 build lib:asterius exe:ahc exe:ahc-boot exe:ahc-cabal exe:ahc-dist exe:ahc-ld exe:ahc-link exe:ahc-pkg --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/bollu/work/asterius/.stack-work/logs/asterius-0.0.1.log
@bollu
bollu / from branch.json
Created May 17, 2019
Test suite data - from GHC and from the tasty wrapper
View from branch.json
[
{
"trPath": "test/ghc-testsuite/perf/T10359.hs",
"trOutcome": "TestFailure",
"trErrorMessage": "expected: RunSuccess\n but got: RunFailureγ\"EvalException {evalErrorMessage = \\\"file:///home/bollu/work/asterius/asterius/test/ghc-testsuite/perf/rts.integer.mjs:73\\\\n ? this.decode(bi).toString(Number(this.decode(b))).length - 1\\\\n ^\\\\n\\\\nTypeError: Cannot read property 'toString' of undefined\\\\n at IntegerManager.integerLogBase (file:///home/bollu/work/asterius/asterius/test/ghc-testsuite/perf/rts.integer.mjs:73:33)\\\\n at __asterius_jsffi_integerzmwiredzminzuGHCziIntegerziLogarithmsziInternals_5332261958806686639 (file:///home/bollu/work/asterius/asterius/test/ghc-testsuite/perf/T10359.lib.mjs:3:481)\\\\n at __asterius_jsffi_integerzmwiredzminzuGHCziIntegerziLogarithmsziInternals_5332261958806686639_wrapper (wasm-function[111]:4)\\\\n at base_GHCziFloat_zdwzdsfromRatzqzq_entry (wasm-function[1375]:341)\\\\n at
@bollu
bollu / dump
Created May 10, 2019
Dump of module from bytearraymini.hs
View dump
This file has been truncated, but you can view the full file.
Module
{ sections =
[ TypeSection
{ types =
[ FunctionType { parameterTypes = [] , resultTypes = [] }
, FunctionType { parameterTypes = [] , resultTypes = [ I32 ] }
, FunctionType { parameterTypes = [ I32 ] , resultTypes = [] }
, FunctionType { parameterTypes = [ I32 ] , resultTypes = [ I32 ] }
, FunctionType { parameterTypes = [ I32 ] , resultTypes = [ F64 ] }
@bollu
bollu / count-cloverleaf-openacc-delta.sh
Created Apr 6, 2019
find number of lines of code in openacc version versus normal version
View count-cloverleaf-openacc-delta.sh
#!/usr/bin/env bash
NUM_PRAGMA_LINES=$(grep '!$ACC' -R openacc | wc -l)
NUM_FORTRAN_LINES=$(cloc openacc/*.f90 -csv | tail -1 | rev | cut -d',' -f 1 | rev)
echo "num pragma lines: " $NUM_PRAGMA_LINES
echo "total lines in opanacc: " $NUM_FORTRAN_LINES
echo "ratio:"
python -c "print(100.0 * float($NUM_PRAGMA_LINES) / $NUM_FORTRAN_LINES)"
@bollu
bollu / dualz.hs
Last active Mar 20, 2019
A small implementation of automatic differentiation over the integers for finite differences, using the standard forward-mode-using-dual-numbers trick
View dualz.hs
import Control.Monad (forM_)
-- dual numbers of the form (x + ey), such that e^2 = 0. Formally, elements
-- of the ring (R[x] / x^2)
data Dual = Dual Double Double
instance Show Dual where
show (Dual x x') = "(" ++ show x ++ " + e" ++ show x' ++ ")"
-- create a differentiable dual quantity
-- has derivative 1
View problem.md
Goal
  IHn : (PureCRRec begin1' cr1) # n + (PureCRRec begin2' cr2) # n =
        (PureCRRec (begin1' + begin2') p) # n
  ============================
  (PureCRRec begin1' cr1) # n + (PureCRRec begin2' cr2) # n +
  (cr1 # (S n) + cr2 # (S n)) =
  (PureCRRec (begin1' + begin2') p) # n + p # (S n)
Tactic run:
@bollu
bollu / type-info-mismatch-ghci.md
Last active Oct 20, 2018
Some type magic I don't understand, seems like a.. bug? :info and :type report different types!
View type-info-mismatch-ghci.md

What is the explanation for this -- type?

awaits :: k i -> Plan k o i
  	-- .../src/Data/Machine/Plan.hs:193:1
type role T nominal nominal nominal
data T a b c where
  L :: T a b a
  ...
-- Defined at ...src//Data/Machine/Tee.hs:39:3
You can’t perform that action at this time.