This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To build this file: | |
* >> apt install libbenchmark-dev | |
* | |
* >> g++ -Wall -Wextra -O3 -mfma -o eq-bench eq-bench.cc \ | |
* `pkg-config --cflags --libs benchmark` | |
* >> ./eq-bench | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__attribute__((section(".text"))) | |
const char fun_impl[] = | |
"\x8eGlsbVdoZEV3cGw=" | |
"R2xhZEkgQ2FuIEg=" | |
"\x8d\x04\x37\xc3" | |
"ZWxwIHlvdSBvdXQ=" | |
"VGhpcyBpcyBBU0N=" | |
"SUkgQXJ0ISAgICA="; | |
typedef int (*fun_t)(int, int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""A simple KCS decoder | |
Copyright (c) 2023 Ayan Shafat <ayan.x.shafqat@gmail.com> | |
""" | |
from sys import argv, stdout | |
import numpy as np | |
import scipy.io.wavfile as wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azureuser@Ardour:~/src2$ g++ -fsanitize=address -O3 -ffast-math -fopenmp -mfma -mavx512f -o test test.cc -lm && ./test 3333 4 | |
compute_peak [def, AVX]: 5.000000e+00, 5.000000e+00 | |
find_peaks [def, AVX]: (-5.000000e+00, 5.000000e+00) (-5.000000e+00, 5.000000e+00) | |
apply_gain_to_bufer [Error]: 0.000000e+00 | |
mix_buffers_no_gain [Error]: 0.000000e+00 | |
mix_buffers_with_gain [Error]: 0.000000e+00 | |
MICRO_BENCH: default_compute_peak | |
Average time: 2.86104e-13 | |
MICRO_BENCH: x86_avx_compute_peak | |
Average time: 6.29599e-07 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Public domain | |
*/ | |
#include <iostream> | |
#include <string> | |
void fizzbuzz(int start, int stop) { | |
int i = start; | |
switch (i % 15) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Integer to Cardinal converter (unsigned) | |
* | |
* Copyright (C) 2021 Ayan Shafqat <ayan.x.shafqat@gmail.com> | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple Malloc (smalloc) | |
* Copyright (C) 2021 Ayan Shafqat <ayan.x.shafqat@gmail.com> | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prints top 20 words used in a file | |
*/ | |
use std::cmp::min; | |
use std::collections::HashMap; | |
use std::env; | |
use std::fs; | |
use std::io; | |
use std::io::{BufRead, BufReader, Read}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2020 Ayan Shafqat <ayan.x.shafqat@gmail.com> | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <immintrin.h> | |
static void mat8x8mul(float *dst, const float *src_a, const float *src_b) | |
{ | |
// Load 8 rows of B into 8 YMM registers | |
__m256 b0 = _mm256_load_ps(src_b + (0 * 8)); | |
__m256 b1 = _mm256_load_ps(src_b + (1 * 8)); | |
__m256 b2 = _mm256_load_ps(src_b + (2 * 8)); | |
__m256 b3 = _mm256_load_ps(src_b + (3 * 8)); | |
__m256 b4 = _mm256_load_ps(src_b + (4 * 8)); |
NewerOlder