Skip to content

Instantly share code, notes, and snippets.

View renxida's full-sized avatar
💭
Looking for a job

Xida Ren (Cedar) renxida

💭
Looking for a job
  • Seattle, WA
  • 19:02 (UTC -07:00)
View GitHub Profile
// RUN: torch-mlir-opt <%s -split-input-file -verify-diagnostics -convert-torch-onnx-to-torch
// FB OPT OPS from https://github.com/llvm/torch-mlir/issues/2689
// -----
func.func @cast_operation(%arg0: !torch.vtensor<[?,?,?,?],si64>) -> !torch.vtensor<[?,?,?,?],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 18 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} {
// expected-error @+1 {{failed to legalize operation 'torch.operator'}}
%208 = torch.operator "onnx.Cast"(%arg0) {
torch.onnx.to = 1 : si64
} : (!torch.vtensor<[?,?,?,?],si64>) -> !torch.vtensor<[?,?,?,?],f32>
return %208 : !torch.vtensor<[?,?,?,?],f32>
@renxida
renxida / TorchOps.h.inc
Created December 21, 2023 04:25
TorchOps.h.inc
This file has been truncated, but you can view the full file.
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Op Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: TorchOps.td *|
|* *|
\*===----------------------------------------------------------------------===*/
#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES)
@renxida
renxida / spawnsharkturbine.sh
Last active December 7, 2023 21:17
get the dependencies and run shark turbine
#!/bin/bash
# Xida: I tested this on a fresh GCP machine. It should work on Debian and Ubuntu though.
# deps
sudo apt install wget git -y
# Specify the Miniconda version you want to install
MINICONDA_VERSION="latest"
# For a specific version, replace 'latest' with the version number, e.g., "Miniconda3-4.7.12-Linux-x86_64.sh"
@renxida
renxida / courage.txt
Last active October 23, 2023 15:18
The Courage to be Disliked, A Discord-chat style summary by Visakan and Billy, originally posted on twitter
From @visakanv and @billyisyoung
https://twitter.com/visakanv/status/1037754098328600576?t=mwXfUbS-Mxjr-4zODZjQNw&s=19
The courage to be disliked, Ichiro Kishimi and Fumitake Koga. Heard good things, let’s dig in
Youth tells philosopher, life is hard and complicated and full of struggle. Philosopher says life is simple. Debate ensues
@renxida
renxida / tokc
Created October 19, 2023 20:07
tokc: a token counting utility
#!/usr/bin/env python
"""
tokc: A Token Counter Utility
Description:
-------------
tokc is a tool designed to count tokens in text files or input streams. It's especially useful for calculating the cost of using text with various models.
Installation:
#!/bin/bash
# Install Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
rm miniconda.sh
# Add Miniconda to PATH
export PATH="$HOME/miniconda/bin:$PATH"
for interval in 1 10 50 100 250 500 750 1000 1250 1500 1750 2000
do
./bin/runcpu --define perfinterval=$interval -c benchtaker 644.nab_s
done
sshpass -p 'password' scp ~/spec2017-out xr5ry@portal.cs.virginia.edu:~/benchtaker/data/spec2017-`date '+%Y%m%d%H%M%S'`
#%%
import shutil
import pathlib
import argparse
# use argparse to parse arguments
parser = argparse.ArgumentParser(description='Prepare a LaTeX document for Elicit')
# input folder
parser.add_argument('-i', '--input', help='input folder')
# output folder
@renxida
renxida / no_monitor.txt
Created November 7, 2022 02:15
lsmod on Lillipup with and without USBC to HDMI adaptor & Big Monitor
Module Size Used by
snd_seq_dummy 16384 0
snd_seq 57344 5 snd_seq_dummy
snd_seq_device 16384 1 snd_seq
bridge 126976 0
stp 16384 1 bridge
llc 16384 2 bridge,stp
tun 45056 21
vhost_vsock 20480 14
vhost 36864 1 vhost_vsock
@renxida
renxida / napkin.py
Created July 9, 2022 06:57
Post from Terminal to napkin.one
#!/usr/bin/env python3
import requests
import json
import sys
# insert your own code and uid here
# see instructions at https://gist.github.com/renxida/9fc62a224339ce75db8c33ec6ebd8305
# on how to get them
uid = "aBcD1234"
code= "12345"