Skip to content

Instantly share code, notes, and snippets.

View makslevental's full-sized avatar
💩

Maksim Levental makslevental

💩
View GitHub Profile
// Copyright 2024 The IREE Authors
//
// Licensed 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
#include <cstdint>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
//
// Created by mlevental on 9/19/24.
//
#include "amdxdna_accel.h"
#include <csignal>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
// Copyright 2024 The IREE Authors
//
// Licensed 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
#include <csignal>
#include <cstdint>
#include <cstdlib>
#include <fcntl.h>
import ctypes
import fcntl
from ctypes import CDLL, c_int, c_void_p, c_size_t, c_long, c_uint32
from mmap import PROT_READ, PROT_WRITE, MAP_SHARED, MAP_PRIVATE
from pathlib import Path
import numpy as np
from ioctlpy.amdxdna_accel import (
AMDXDNA_BO_CMD,
@makslevental
makslevental / ClangClCMakeCompileRules.cmake
Created August 29, 2024 03:26
cross-compile linux -> windows
# macOS paths usually start with /Users/*. Unfortunately, clang-cl interprets
# paths starting with /U as macro undefines, so we need to put a -- before the
# input file path to force it to be treated as a path. CMake's compilation rules
# should be tweaked accordingly, but until that's done, and to support older
# CMake versions, overriding compilation rules works well enough. This file will
# be included by cmake after the default compilation rules have already been set
# up, so we can just modify them instead of duplicating them entirely.
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")
#!/bin/bash
#
# Copyright 2024 The IREE Authors
#
# Licensed 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
# Manual IREE matmul test script.
#
namespace mlir {
namespace iree_compiler {
namespace AMDAIE {
// "); static_assert(always_false<ParserT>, "this FieldParser should never be instantiated"); //
enum class FooDir : uint32_t {
S2MM = 0,
MM2S = 1,
};
::std::optional<FooDir> symbolizeFooDir(uint32_t);
struct GeneratedConvert0 : public mlir::RewritePattern {
GeneratedConvert0(MLIRContext *context)
: mlir::RewritePattern("memref.global", 21, context, {"memref.global"}) {}
llvm::LogicalResult matchAndRewrite(
mlir::Operation *op0, mlir::PatternRewriter &rewriter) const override {
// Variables for capturing values and attributes used while creating ops
mlir::IntegerAttr attrs;
mlir::UnitAttr constant;
mlir::StringAttr sym_visibility;
mlir::Attribute initial_value;
module {
aie.device(npu1_4col) {
%tile_0_0 = aie.tile(0, 0)
%tile_0_1 = aie.tile(0, 1)
%tile_1_1 = aie.tile(1, 1)
%tile_2_1 = aie.tile(2, 1)
%tile_0_2 = aie.tile(0, 2)
%lock_1_1 = aie.lock(%tile_1_1, 1) {init = 1 : i32}
%lock_1_1_0 = aie.lock(%tile_1_1, 0) {init = 0 : i32}
%lock_0_1 = aie.lock(%tile_0_1, 1) {init = 1 : i32}
@makslevental
makslevental / repair.py
Created July 15, 2024 21:48
auditwheel don't delete/rename sos
import os
import shutil
import stat
from os.path import isabs, abspath, basename, exists
from os.path import join as pjoin
from pathlib import Path
from auditwheel.policy import WheelPolicies
from auditwheel.repair import WHEEL_INFO_RE
from auditwheel.wheel_abi import get_wheel_elfdata