Skip to content

Commit

Permalink
add csky support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirreke committed Jan 16, 2024
1 parent c259e24 commit cd2d277
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 14 deletions.
12 changes: 6 additions & 6 deletions openblas-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ readme = "../README.md"
exclude = ["test_build/"]

[dependencies]
anyhow = "1.0.68"
flate2 = "1.0.25"
tar = "0.4.38"
thiserror = "1.0.22"
ureq = { version = "2.5.0", default-features = false, features = [
anyhow = "1.0.79"
flate2 = "1.0.28"
tar = "0.4.40"
thiserror = "1.0.56"
ureq = { version = "2.9.1", default-features = false, features = [
"native-certs",
"native-tls",
"gzip",
] }
native-tls = { version = "0.2.11" }
walkdir = "2.3.1"
walkdir = "2.4.0"
72 changes: 71 additions & 1 deletion openblas-build/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub enum Target {
HASWELL,
SKYLAKEX,
ATOM,
COOPERLAK,
SAPPHIRERAPIDS,

// X86/X86_64 AMD
ATHLON,
Expand Down Expand Up @@ -98,17 +100,50 @@ pub enum Target {
CORTEXA57,
CORTEXA72,
CORTEXA73,
CORTEXA510,
CORTEXA710,
CORTEXX1,
CORTEXX2,
NEOVERSEN1,
NEOVERSEV1,
NEOVERSEN2,
CORTEXA55,
EMAG8180,
FALKOR,
THUNDERX,
THUNDERX2T99,
TSV110,
THUNDERX3T110,
VORTEX,
A64FX,
ARMV8SVE,
FT2000,

// System Z
ZARCH_GENERIC,
Z13,
Z14,

// RISC-V 64:
RISCV64_GENERIC,
C910V,

// LOONGARCH64:
LOONGSONGENERIC,
LOONGSON3R5,
LOONGSON2K1000,

// Elbrus E2000:
E2K,

// Alpha
EV4,
EV5,
EV6,

// CSKY
CSKY,
CK860FV,
}

impl FromStr for Target {
Expand All @@ -132,6 +167,8 @@ impl FromStr for Target {
"haswell" => Self::HASWELL,
"skylakex" => Self::SKYLAKEX,
"atom" => Self::ATOM,
"cooperlak" => Self::COOPERLAK,
"sapphirerapids" => Self::SAPPHIRERAPIDS,

// X86/X86_64 AMD
"athlon" => Self::ATHLON,
Expand Down Expand Up @@ -199,17 +236,50 @@ impl FromStr for Target {
"cortexa57" => Self::CORTEXA57,
"cortexa72" => Self::CORTEXA72,
"cortexa73" => Self::CORTEXA73,
"cortexa510" => Self::CORTEXA510,
"cortexa710" => Self::CORTEXA710,
"cortexx1" => Self::CORTEXX1,
"cortexx2" => Self::CORTEXX2,
"neoversen1" => Self::NEOVERSEN1,
"neoversev1" => Self::NEOVERSEV1,
"neoversen2" => Self::NEOVERSEN2,
"cortexa55" => Self::CORTEXA55,
"emag8180" => Self::EMAG8180,
"falkor" => Self::FALKOR,
"thunderx" => Self::THUNDERX,
"thunderx2t99" => Self::THUNDERX2T99,
"tsv110" => Self::TSV110,

"thunderx3t110" => Self::THUNDERX3T110,
"vortex" => Self::VORTEX,
"a64fx" => Self::A64FX,
"armv8sve" => Self::ARMV8SVE,
"ft2000" => Self::FT2000,

// System Z
"zarch_generic" => Self::ZARCH_GENERIC,
"z13" => Self::Z13,
"z14" => Self::Z14,

// RISC-V 64:
"riscv_generic" => Self::RISCV64_GENERIC,
"c910v" => Self::C910V,

// LOONGARCH64:
"loongsongeneric" => Self::LOONGSONGENERIC,
"longson3r5" => Self::LOONGSON3R5,
"longson2k1000" => Self::LOONGSON2K1000,

// Elbrus E2000:
"e2k" => Self::E2K,

// Alpha
"ev4" => Self::EV4,
"ev5" => Self::EV5,
"ev6" => Self::EV6,

// CSKY
"csky" => Self::CSKY,
"ck860fv" => Self::CK860FV,

_ => {
return Err(Error::UnsupportedTarget {
Expand Down
11 changes: 6 additions & 5 deletions openblas-build/src/download.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use anyhow::Result;
use std::path::{Path, PathBuf};

const OPENBLAS_VERSION: &str = "0.3.21";
const OPENBLAS_VERSION: &str = "csky-support";

pub fn openblas_source_url() -> String {
format!(
"https://github.com/xianyi/OpenBLAS/releases/download/v{}/OpenBLAS-{}.tar.gz",
OPENBLAS_VERSION, OPENBLAS_VERSION
)
// format!(
// "https://github.com/OpenMathLib/OpenBLAS/releases/download/v{}/OpenBLAS-{}.tar.gz",
// OPENBLAS_VERSION, OPENBLAS_VERSION
// )
"https://codeload.github.com/Dirreke/OpenBLAS/tar.gz/refs/heads/csky-support".to_string()
}

pub fn download(out_dir: &Path) -> Result<PathBuf> {
Expand Down
2 changes: 1 addition & 1 deletion openblas-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ system = []
libc = "0.2"

[build-dependencies]
dirs = "3.0.1"
dirs = "5.0.1"
openblas-build = { version = "0.10.8", path = "../openblas-build" }

[target.'cfg(target_os="windows")'.build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion openblas-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn build() {
let output = if feature_enabled("cache") {
use std::{collections::hash_map::DefaultHasher, hash::*};
// Build OpenBLAS on user's data directory.
// See https://docs.rs/dirs/3.0.1/dirs/fn.data_dir.html
// See https://docs.rs/dirs/5.0.1/dirs/fn.data_dir.html
//
// On Linux, `data_dir` returns `$XDG_DATA_HOME` or `$HOME/.local/share`.
// This build script creates a directory based on the hash value of `cfg`,
Expand Down

0 comments on commit cd2d277

Please sign in to comment.