Commit 601defcb authored by YdrMaster's avatar YdrMaster
Browse files

issue/87/refactor: 修改 infiniop/handle.h,现在 infiniop 依赖 infinirt 创建指定硬件的 handle


Signed-off-by: default avatarYdrMaster <ydrml@hotmail.com>
parent d64c1b0f
#ifndef __INFINIOP_API_H__
#define __INFINIOP_API_H__
#include "infiniop/tensor_descriptor.h"
#include "infiniop/handle.h"
#include "infiniop/ops/add.h"
#include "infiniop/ops/attention.h"
......@@ -19,5 +19,6 @@
#include "infiniop/ops/rms_norm.h"
#include "infiniop/ops/rotary_embedding.h"
#include "infiniop/ops/swiglu.h"
#include "infiniop/tensor_descriptor.h"
#endif // __INFINIOP_API_H__
......@@ -7,7 +7,7 @@ struct InfiniopHandle;
typedef InfiniopHandle *infiniopHandle_t;
__C __export infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr, infiniDevice_t device);
__C __export infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr);
__C __export infiniStatus_t infiniopDestroyHandle(infiniopHandle_t handle);
......
#include "infiniop/handle.h"
#include "../../utils.h"
#include "infinirt.h"
#ifdef ENABLE_CPU_API
#include "cpu/cpu_handle.h"
#endif
......@@ -15,12 +18,15 @@
#include "kunlun/kunlun_handle.h"
#endif
__C infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr,
infiniDevice_t device) {
__C infiniStatus_t infiniopCreateHandle(infiniopHandle_t *handle_ptr) {
if (handle_ptr == nullptr) {
return INFINI_STATUS_NULL_POINTER;
}
infiniDevice_t device;
int device_id;
CHECK_STATUS(infinirtGetDevice(&device, &device_id));
switch (device) {
#ifdef ENABLE_CPU_API
case INFINI_DEVICE_CPU:
......
......@@ -119,8 +119,25 @@ target("infini-utils")
add_files("src/utils/*.cc")
target_end()
target("infinirt")
set_kind("shared")
if has_config("cpu") then
add_deps("infinirt-cpu")
end
if has_config("nv-gpu") then
add_deps("infinirt-cuda")
end
set_languages("cxx17")
set_installdir(os.getenv("INFINI_ROOT") or (os.getenv(is_host("windows") and "HOMEPATH" or "HOME") .. "/.infini"))
add_files("src/infinirt/*.cc")
add_installfiles("include/infinirt.h")
target_end()
target("infiniop")
set_kind("shared")
add_deps("infinirt")
if has_config("cpu") then
add_deps("infiniop-cpu")
end
......@@ -166,20 +183,6 @@ target("infiniop")
add_installfiles("include/infinicore.h", {prefixdir = "include"})
target_end()
target("infinirt")
set_kind("shared")
if has_config("cpu") then
add_deps("infinirt-cpu")
end
if has_config("nv-gpu") then
add_deps("infinirt-cuda")
end
set_languages("cxx17")
set_installdir(os.getenv("INFINI_ROOT") or (os.getenv(is_host("windows") and "HOMEPATH" or "HOME") .. "/.infini"))
add_files("src/infinirt/*.cc")
add_installfiles("include/infinirt.h")
target_end()
target("all")
set_kind("phony")
add_deps("infiniop", "infinirt")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment