Skip to content

Instantly share code, notes, and snippets.

View tgymnich's full-sized avatar
🛰️

Tim Gymnich tgymnich

🛰️
View GitHub Profile
@tgymnich
tgymnich / prob.cpp
Last active October 14, 2022 15:10
#include <iostream>
#include <map>
#include <math.h>
#include <random>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
#include <execinfo.h>
#include <random>
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
extern void __enzyme_autodiff(void *, int, double *, double *);
extern void __enzyme_prob(...);
extern double __enzyme_normal(double (double, double), double, double);
extern int enzyme_dup;
{
"leaf_nodes": {
"y-6": {
"subtrace_or_retval": -0.66,
"score": -47.90875243406383,
"noise": null,
"is_choice": true
},
"y-4": {
"subtrace_or_retval": 2.59,
#include <execinfo.h>
#include <random>
#include <stdio.h>
extern void __enzyme_autodiff(void *, int, double *, double *);
extern void __enzyme_prob(...);
extern double __enzyme_normal(double (double, double), double, double);
extern int enzyme_dup;
double normal(double mean, double var) {
define internal { i8* } @fakeaugmented__ZN5Eigen8internal17product_evaluatorINS_7ProductINS_13CwiseBinaryOpINS0_20scalar_difference_opIddEEKNS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEES8_EES9_Li0EEELi8ENS_10DenseShapeESB_ddEC2ERKSA_(%"struct.Eigen::internal::product_evaluator"* nonnull returned dereferenceable(40) %this, %"struct.Eigen::internal::product_evaluator"* %"this'", %"class.Eigen::Product"* nonnull align 8 dereferenceable(48) %xpr, %"class.Eigen::Product"* %"xpr'") unnamed_addr #19 align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
%malloccall1 = tail call noalias nonnull dereferenceable(1) dereferenceable_or_null(1) i8* @malloc(i64 1), !enzyme_fromstack !178
%"malloccall1'mi" = phi i8*
%ref.tmp.i = bitcast i8* %malloccall1 to %"struct.Eigen::internal::assign_op"*
%malloccall = tail call noalias nonnull dereferenceable(48) dereferenceable_or_null(48) i8* @malloc(i64 48), !enzyme_fromstack !179
%"malloccall'mi" = phi i8*
%ref.tmp.i.i.i = bitcast i8* %malloccall
in new function diffe_ZL6matvecPKN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEES3_ nonconstant arg %"class.Eigen::Matrix"* %0
in new function diffe_ZL6matvecPKN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEES3_ nonconstant arg %"class.Eigen::Matrix"* %0
checking if is constant[3] %thisEval.i.i = alloca %"class.Eigen::internal::redux_evaluator", align 8
constant instruction from known non-float non-writing instruction %thisEval.i.i = alloca %"class.Eigen::internal::redux_evaluator", align 8
<Value USESEARCH2> %thisEval.i.i = alloca %"class.Eigen::internal::redux_evaluator", align 8 UA=1
considering use of %thisEval.i.i = alloca %"class.Eigen::internal::redux_evaluator", align 8 - %m_result.i.i.i.i8.i.i = getelementptr inbounds %"class.Eigen::internal::redux_evaluator", %"class.Eigen::internal::redux_evaluator"* %thisEval.i.i, i64 0, i32 0, i32 0, i32 1
considering use of %thisEval.i.i = alloca %"class.Eigen::internal::redux_evaluator", align 8 - %m_outerStride.i.i.i.i.i.i = getelementptr inbou
@tgymnich
tgymnich / BitwiseRotateARM.S
Last active December 1, 2021 17:01
BitwiseRotate on M1 Max (Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6))
_main:
mov w0, #0
ret
(extension in output):Swift.FixedWidthInteger.rotateLeft(Swift.Int) -> A:
adrp x3, _$ss17FixedWidthIntegerP3alloiyxx_xtFZTj@GOTPAGE
ldr x3, [x3, _$ss17FixedWidthIntegerP3alloiyxx_xtFZTj@GOTPAGEOFF]
adrp x4, _$ss17FixedWidthIntegerP3aggoiyxx_xtFZTj@GOTPAGE
ldr x4, [x4, _$ss17FixedWidthIntegerP3aggoiyxx_xtFZTj@GOTPAGEOFF]
b merged (extension in output):Swift.FixedWidthInteger.rotateLeft(Swift.Int) -> A
This file has been truncated, but you can view the full file.
vscode@1b1847a1ee68:/workspaces/Enzyme$ cd enzyme/build/
vscode@1b1847a1ee68:/workspaces/Enzyme/enzyme/build$ cmake .. -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=Debug -DLLVM_DIR=/usr/lib/llvm-12/lib/cmake/
LLVM_SHLIBEXT=.so
found llvm dir /usr/lib/llvm-12/lib/cmake
found llvm lit /usr/local/bin/lit
CMAKE_PREFIX_PATH /usr/lib/llvm-12/lib/cmake
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
LLVM_INSTALL_PREFIX: /usr/lib/llvm-12
LLVM_INCLUDE_DIRS: /usr/lib/llvm-12/include
found llvm definitions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
This file has been truncated, but you can view the full file.
vscode@1b1847a1ee68:/workspaces/Enzyme/enzyme/build$ make -j 8 check-enzyme-integration-reverse
[ 0%] Built target intrinsics_gen
[ 8%] Built target BCPass-12
[ 10%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/ActivityAnalysis.cpp.o
[ 13%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/ActivityAnalysisPrinter.cpp.o
[ 16%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/CApi.cpp.o
[ 18%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/CacheUtility.cpp.o
[ 21%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/EnzymeLogic.cpp.o
[ 24%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/Enzyme.cpp.o
[ 27%] Building CXX object Enzyme/CMakeFiles/ClangEnzyme-12.dir/FunctionUtils.cpp.o
#!/bin/bash
git -C /home/tim/Enzyme fetch
HEADHASH=$(git -C /home/tim/Enzyme rev-parse HEAD)
UPSTREAMHASH=$(git -C /home/tim/Enzyme rev-parse main@{upstream})
if [ "$HEADHASH" != "$UPSTREAMHASH" ]
then
bash /home/tim/build.sh
exit 0