Skip to content

Instantly share code, notes, and snippets.

View poyenc's full-sized avatar
🌸

Po Yen Chen poyenc

🌸
  • Seoul, Republic of Korea
View GitHub Profile
SRC = main.cpp
ARCH = gfx942
INC_DIR = include/ck_tile
all:
clang++ -fsyntax-only -I$(INC_DIR) -x hip --offload-arch=$(ARCH) $(SRC)
@poyenc
poyenc / hiprtcGetLoweredName.cpp
Created October 5, 2022 20:14
Try out HIP RTC
#include <hip/hiprtc.h>
#include <hip/hip_runtime.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
static constexpr const char gpu_program[]{
R"(
@poyenc
poyenc / memo.sh
Last active June 10, 2022 03:59
How to verify the modified compiler output (on MKM-UBB4-3)
# run packed docker image
docker run \
-it \
--privileged \
--group-add sudo \
poyenc/9110-mod:latest
# configure CK
cd ~/composable_kernel
mkdir build && cd build
@poyenc
poyenc / main.cpp
Last active January 3, 2022 05:29
HIP programing matrix multiplication exercise
#include <array>
#include <cassert>
#include <chrono>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
// CodeEmitVisitor.h
class CodeEmitVisitor : public CustomVisitor<CodeEmitVisitor>, private NvDlaConstants
{
public:
void visit(const Conv& pConv) override;
void visit(Conv& pConv) override;
// 1. add visit method for const Add IR
void visit(const Add& pOp) override;
// 2. add visit method for non-const Add IR, force it calls the previous version
@poyenc
poyenc / shuffle_order_generator.hpp
Created April 17, 2020 23:43
Generator adaptor which shuffle the value orders returned by underlying generator
#pragma once [33/1792]
#include <algorithm>
#include <cstddef>
#include <deque>
#include <functional>
#include <limits>
#include <random>
#include <type_traits>
#include <utility>
@poyenc
poyenc / jump_iterator.hpp
Created April 17, 2020 23:40
Iterator adaptor which use generator to decide where to point
#pragma once [27/1718]
#include <iterator>
#include <memory>
#include <type_traits>
#include <utility>
namespace poyenc {
template <typename Iterator, typename Generator>
@poyenc
poyenc / sequence_generator.hpp
Created April 17, 2020 23:36
Simple integer sequence generator
#pragma once
#include <stdexcept>
#include <type_traits>
#include <utility>
namespace poyenc {
template <typename IntType = int>
class sequence_generator {
@poyenc
poyenc / index_iterator.hpp
Last active April 3, 2020 08:13
Iterator adaptor for random access range which has not provided iterator interfaces (C++17)
#pragma once
#include <iterator>
#include <type_traits>
#include <utility>
template <typename RandomAccessRange>
class index_iterator {
public:
using target_type = RandomAccessRange;
@poyenc
poyenc / example.cpp
Last active November 29, 2019 15:00
visit() for polymorphic types (use std::overload_set)
#include <cassert>
#include <cstddef>
#include <iostream>
#include <type_traits>
#include <utility>
namespace poyenc {
namespace mpl {
template <typename...>