Skip to content

Instantly share code, notes, and snippets.

@abadams
abadams / gist:422d7ea52c8a7320bc6cd632ec02e50d
Created May 8, 2018 14:44
Probably true things that the Halide simplifier can't prove
(max(((17 - (v0 % 4))/4), ((max(((min((v1*2), ((v0 % 2) + 5)) + (v0/2))/2), ((v0/4) + v1)) - (((v0 + -6)/4) + v1)) + 2)) <= 1024)
(max(((17 - (v0 % 4))/4), ((((min((v1*2), ((v0 % 2) + 20)) + (v0/2))/2) - (((v0 + -6)/4) + v1)) + 2)) <= 1024)
(max(((8 - (((v0*161) + v1) % 2))/2), ((((min((v2*2), 159) + ((v0*161) + v1))/2) - (((((v0*161) + v1) + -3)/2) + v2)) + 2)) <= 1024)
(max(max(min(v0, 12), (min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(((v1 + -15)/16), (v2 + -1)), ((v1 + -14)/16)), ((v1 + -13)/16)), ((v1 + -2)/16)), ((v1 + -1)/16)), ((v1 + 1)/16)), ((v3 + -2)/16)), ((v3 + -1)/16)), ((v4 + -2)/16)), ((v4 + -1)/16)), ((v5 + -2)/16)), ((v5 + -1)/16)), ((v6 + -2)/16)), ((v6 + -1)/16)), 11) + 1)), 0) <= max(min(v0, 12), 0))
(max(max(min(((v0 + 131)/144), 2), (min(((min((min(min(min(min(min(min((min((((v1 + v2) + 25)/2), v3) - ((v4*288) + v5)), v6), (min((((v1 + v2) + 29)/2), v3) - ((v4*288) + v5))), (v7 + 13)), v8), v9), (v7 + 15)) + 128), v8) + -140)/144), 1) + 1)), 0) <= max(min(((v0 + 131)

Keybase proof

I hereby claim:

  • I am abadams on github.
  • I am abadams (https://keybase.io/abadams) on keybase.
  • I have a public key ASAm3P6tql93IPmgJWn3VxppYs7znurwEtj30edT-4Hvsgo

To claim this, I am signing this object:

@abadams
abadams / gist:d77665c791678d97e07803aca91908cc
Created April 5, 2018 00:40
fast_synchronization windows performance
ubuntu-on-windows-10 in branch
performance_inner_loop_parallel 71.7ms
performance_parallel_performance 0.020
bilateral grid 16.89 / 10.9
blur 7.00
camera pipe 7.162 / 32.739
conv layer 7.09 / 6.03
interpolate 36.815
lens blur 8.10 / 36.44
local laplacian 74.23 / 76.138
Halide:
1.42 │ e0: vmovup -0x60(%rdi),%ymm0
4.50 │ vmovup -0x40(%rdi),%ymm6
4.97 │ vmovup -0x20(%rdi),%ymm7
2.54 │ vmovup (%rdi),%ymm8
30.71 │ vfmadd (%rsi),%ymm5,%ymm8
7.82 │ vfmadd -0x20(%rsi),%ymm5,%ymm7
22.69 │ vfmadd -0x40(%rsi),%ymm5,%ymm6
// This sucks. foo, bar, and baz are mentioned way too many times, mostly just to capture references to them.
bool my_function(Expr e) {
Foo foo = ...;
Bar bar = ...;
Baz baz = ...;
class CheckForSpecialNode : public IRVisitor {
using IRVisitor::visit;
abadams@abadams-mbp:/Applications/Adobe Photoshop CC 2018/Adobe Photoshop CC 2018.app/Contents/Required/Plug-ins/Extensions/HalideBottlenecks.plugin/Contents/MacOS
$ strings HalideBottlenecks | grep ^Halide
HalideBNBlend8ProcWrapper
HalideGenBNColorOnly_sse41
HalideGenBNColorOnlyConst_sse41
HalideGenBNColorOnlyConstDeep_sse41
HalideGenBNColorOnlyConstFloat_sse41
HalideGenBNColorOnlyDeep_sse41
HalideGenBNColorOnlyFloat_sse41
.version 4.0
.target sm_50
.address_size 64
// .globl kernel_out_s0_y_y___block_id_y // -- Begin function kernel_out_s0_y_y___block_id_y
// @kernel_out_s0_y_y___block_id_y
.visible .entry kernel_out_s0_y_y___block_id_y(
.param .u32 kernel_out_s0_y_y___block_id_y_param_0,
.param .u32 kernel_out_s0_y_y___block_id_y_param_1,
.param .u32 kernel_out_s0_y_y___block_id_y_param_2,
@abadams
abadams / embiggen_stack.cpp
Last active February 6, 2017 21:23
Demonstration of swapping out the stack pointer
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int silly_factorial(int i) {
if (i == 0) {
int x;
printf("Hello from %p\n", &x);
return 1;
}
@abadams
abadams / gist:ac5c401da3feb1a892ebb0c56fb3008c
Created January 11, 2017 03:30
msvc output with new CMake config
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Release x64 ------
1> Checking Build System
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/src/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/tools/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/test/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/tutorial/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/b/slave/win-64-trunk/halide-build-Release/util/CMakeFiles/generate.stamp is up-to-date.
2>------ Rebuild All started: Project: bitcode2cpp, Configuration: Release x64 ------
3>------ Rebuild All started:
@abadams
abadams / test.cpp
Created December 23, 2016 01:46
Scheduling a chain of horizontal stencils
#include "Halide.h"
#include "benchmark.h"
using namespace Halide;
int main(int argc, char **argv) {
Var x, y, z, yi, xi;
Func f1, f2, res;
ImageParam input1(type_of<float>(), 3);