Skip to content

Instantly share code, notes, and snippets.

View degski's full-sized avatar
💭
stop watching us

degski

💭
stop watching us
View GitHub Profile
// prfchwintrin.h
/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===-----------------------------------------------------------------------===
*/
/************************************************************************
http://www.incompleteideas.net/
http://www.incompleteideas.net/td-backprop-pseudo-code.text
Nonlinear TD/Backprop pseudo C-code
Written by Allen Bonde Jr. and Rich Sutton in April 1992.
// https://morestina.net/blog/1400/minimalistic-blocking-bounded-queue-for-c
template<typename T>
class queue {
std::deque<T> content;
size_t capacity;
std::mutex mutex;
std::condition_variable not_empty;
std::condition_variable not_full;
@degski
degski / mimalloc.h
Last active July 4, 2019 07:24
Auto-linking various library builds
// MIT License
//
// Copyright (c) 2019 degski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@degski
degski / compile_mimalloc.cmd
Last active September 29, 2020 09:13
Compile mimalloc with clang/llvm, both with and without thin-lto, both standard and secure.
:: MIT License
::
:: Copyright (c) 2019, 2020 degski
::
:: Permission is hereby granted, free of charge, to any person obtaining a copy
:: of this software and associated documentation files (the "Software"), to deal
:: in the Software without restriction, including without limitation the rights
:: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
:: copies of the Software, and to permit persons to whom the Software is
@degski
degski / main.cpp
Created June 14, 2019 06:03
Vose Alias Method - discrete_distribution
// MIT License
//
// Copyright (c) 2019 degski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@degski
degski / bug.cpp
Created May 6, 2019 15:10
Clang bug 38102
// MIT License
//
// Copyright (c) 2019 degski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@degski
degski / stack-dump.txt
Last active May 6, 2019 13:21
Clang bug 41745-3
1>Stack dump:
1>0. Program arguments: C:\Program Files\LLVM\bin\clang-cl.exe -cc1 -triple x86_64-pc-windows-msvc19.16.27030 -emit-obj -mincremental-linker-compatible -disable-free -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fno-trapping-math -ffp-contract=fast -ffast-math -ffinite-math-only -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu haswell -mllvm -x86-asm-syntax=intel -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdefault-calling-conv=cdecl -fdiagnostics-format msvc -dwarf-column-info -momit-leaf-frame-pointer -ffunction-sections -coverage-notes-file Y:\REPOS\gmp_random\gmp_random\main.gcno -resource-dir C:\Program Files\LLVM\lib\clang\9.0.0 -I y:\vcpkg\installed\x64-windows-static\include -D WIN64 -D NDEBUG
@degski
degski / main-469827.sh
Created May 6, 2019 13:19
Clang bug 41745-2
# Crash reproducer for clang version 9.0.0 (trunk)
# Driver args: "--driver-mode=cl" "-c" "-I" "y:\\vcpkg\\installed\\x64-windows-static\\include" "/nologo" "-Wall" "-Wno-error" "/diagnostics:classic" "/Ox" "/Oi" "-D" "WIN64" "-D" "NDEBUG" "-D" "_CONSOLE" "-D" "NOMINMAX" "-D" "MPPP_BUILD_STATIC_LIBRARY" "-D" "MPPP_STATIC" "-D" "MPPP_PUBLIC=" "-D" "_UNICODE" "-D" "UNICODE" "/EHsc" "/MT" "/GS" "-ffunction-sections" "/arch:AVX2" "-ffast-math" "/permissive-" "/std:c++17" "/FoY:\\REPOS\\gmp_random\\x64\\Release\\" "/Gd" "/TP" "-m64" "main.cpp"
# Original command: "C:\\Program Files\\LLVM\\bin\\clang-cl.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.16.27030" "-emit-obj" "-mincremental-linker-compatible" "-disable-free" "-main-file-name" "main.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-relaxed-aliasing" "-menable-no-infs" "-menable-no-nans" "-menable-unsafe-fp-math" "-fno-signed-zeros" "-mreassociate" "-freciprocal-math" "-fno-trapping-math" "-ffp-contract=fast" "-ffast-math" "-ff
@degski
degski / main-469827.cpp
Created May 6, 2019 13:14
Clang bug 41745
This file has been truncated, but you can view the full file.
# 1 "<built-in>"
# 1 "main.cpp"
#if 0 /* expanded by -frewrite-includes */
#include <cassert>
#endif /* expanded by -frewrite-includes */
# 2 "main.cpp"
# 1 "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\include\\cassert" 1 3
// cassert standard header
// NOTE: no include guard