Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@
driver/xrt/src/m2m
driver/xrt/build
.vscode
coyote_build*
*xcu55c-fsvh2892-2L-e*
*_prj
*.gen
*.ip_user_files
*.cache
*.srcs
2 changes: 2 additions & 0 deletions driver/xrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ set(ACCL_DOCS_RST
)

set(EN_COYOTE ON)
set(EN_AVX 1 CACHE STRING "AVX environment.")
if(EN_COYOTE)
message("Enable Coyote")
set(ACCL_HEADERS
Expand All @@ -88,6 +89,7 @@ if(EN_COYOTE)
file(GLOB COYOTE_SOURCE "${COYOTE_SOURCE_PATH}/*.cpp")

if(EN_AVX)
add_definitions(-DEN_AVX)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -mavx -march=native -O3")
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -march=native -O1")
Expand Down
20 changes: 14 additions & 6 deletions driver/xrt/include/accl/coyotebuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once
#include "buffer.hpp"
#include "common.hpp"
#include "cProcess.hpp"
#include "cThread.hpp"
#include "cDefs.hpp"
#include "coyotedevice.hpp"
#include <cstdlib>
Expand Down Expand Up @@ -59,7 +59,7 @@ template <typename dtype> class CoyoteBuffer : public Buffer<dtype> {
this->n_pages = (buffer_size + page_size - 1) / page_size;
std::cerr << "CoyoteBuffer contructor called! page_size:"<<page_size<<", buffer_size:"<<buffer_size<<",n_pages:"<<n_pages<< std::endl;

this->aligned_buffer = (dtype *)this->device->coyote_proc->getMem({fpga::CoyoteAlloc::HUGE_2M, n_pages});
this->aligned_buffer = (dtype *)this->device->coyote_proc->getMem({fpga::CoyoteAlloc::HPF, n_pages});

this->update_buffer(this->aligned_buffer, (addr_t)this->aligned_buffer);

Expand Down Expand Up @@ -114,20 +114,28 @@ template <typename dtype> class CoyoteBuffer : public Buffer<dtype> {
{
std::cerr << "calling sync: " << std::setbase(16) << (uint64_t)this->aligned_buffer << ", size: " << std::setbase(10) << this->size() << std::endl;

this->device->coyote_proc->invoke({fpga::CoyoteOper::SYNC, this->aligned_buffer, (uint32_t)this->_size, true, true, 0, false});
fpga::sgEntry sg;
memset(&sg, 0, sizeof(fpga::syncSg));
sg.sync.addr = this->aligned_buffer;

this->device->coyote_proc->invoke(fpga::CoyoteOper::LOCAL_SYNC, &sg, {true, true, true});

this->host_flag = true;
}

/**
* Sync the data from the host to the device.
*
*
*/
void sync_to_device() override
{
std::cerr << "calling offload: " << std::setbase(16) << (uint64_t)this->aligned_buffer << ", size: " << std::setbase(10) << this->size() << std::endl;

this->device->coyote_proc->invoke({fpga::CoyoteOper::OFFLOAD, this->aligned_buffer, (uint32_t)this->_size, true, true, 0, false});
fpga::sgEntry sg;
memset(&sg, 0, sizeof(fpga::syncSg));
sg.sync.addr = this->aligned_buffer;

this->device->coyote_proc->invoke(fpga::CoyoteOper::LOCAL_OFFLOAD, &sg, {true, true, true});

this->host_flag = false;
}
Expand All @@ -144,7 +152,7 @@ template <typename dtype> class CoyoteBuffer : public Buffer<dtype> {
// }
// }

std::cerr << "Free user buffer from cProc cPid:"<< std::setbase(10)<<this->device->coyote_proc->getCpid()<<", buffer_size:"<<buffer_size<<","<<std::setbase(16) << (uint64_t)this->aligned_buffer<<std::endl;
std::cerr << "Free user buffer from cProc cPid:"<< std::setbase(10)<<this->device->coyote_proc->getCtid()<<", buffer_size:"<<buffer_size<<","<<std::setbase(16) << (uint64_t)this->aligned_buffer<<std::endl;
this->device->coyote_proc->freeMem(this->aligned_buffer);
return;
}
Expand Down
12 changes: 6 additions & 6 deletions driver/xrt/include/accl/coyotedevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include "acclrequest.hpp"
#include "cclo.hpp"
#include "constants.hpp"
#include "cProcess.hpp"
#include "ibvQpConn.hpp"
#include "ibvStructs.hpp"
#include "cThread.hpp"
// #include "ibvQpConn.hpp"
// #include "ibvStructs.hpp"
#include <string>
#include <iostream>
#include <fstream>
Expand Down Expand Up @@ -108,7 +108,7 @@ class CoyoteDevice : public CCLO {

void printDebug() override;

fpga::cProcess* get_device(){
fpga::cThread<std::any>* get_device(){
return coyote_proc;
}

Expand All @@ -120,13 +120,13 @@ class CoyoteDevice : public CCLO {

val_t get_retcode(ACCLRequest *request) override;

fpga::cProcess* coyote_proc;
fpga::cThread<std::any>* coyote_proc;

// RDMA related
// RDMA requires multiple processes to establish queue pairs
// The CCLO kernel is still managed by coyote_proc
unsigned int num_qp;
std::vector<fpga::cProcess*> coyote_qProc_vec;
std::vector<fpga::cThread<std::any>*> coyote_qProc_vec;
private:
const size_t OFFSET_CCLO = 0x0;

Expand Down
18 changes: 9 additions & 9 deletions driver/xrt/src/coyotedevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "accl/coyotedevice.hpp"
#include "accl/common.hpp"
#include "cProcess.hpp"
#include "cThread.hpp"
#include <future>
#include <iomanip>

Expand Down Expand Up @@ -276,28 +276,28 @@ void CoyoteRequest::wait_kernel() {
}

CoyoteDevice::CoyoteDevice(): num_qp(0) {
this->coyote_proc = new fpga::cProcess(targetRegion, getpid());
std::cerr << "ACLL DEBUG: aquiring cProc: targetRegion: " << targetRegion << ", cPid: " << coyote_proc->getCpid() << std::endl;
this->coyote_proc = new fpga::cThread<std::any>(targetRegion, getpid(), 0);
std::cerr << "ACLL DEBUG: aquiring cProc: targetRegion: " << targetRegion << ", cPid: " << coyote_proc->getCtid() << std::endl;
}

CoyoteDevice::CoyoteDevice(unsigned int num_qp): num_qp(num_qp) {

for (unsigned int i=0; i<(num_qp+1); i++)
{
fpga::cProcess* cproc = new fpga::cProcess(targetRegion, getpid());
fpga::cThread<std::any>* cproc = new fpga::cThread<std::any>(targetRegion, getpid(), 0);
coyote_qProc_vec.push_back(cproc);
}

for (unsigned int i=0; i<coyote_qProc_vec.size(); i++){
if(coyote_qProc_vec[i]->getCpid() == 0){
if(coyote_qProc_vec[i]->getCtid() == 0){
this->coyote_proc = coyote_qProc_vec[i];
std::cerr << "ACLL DEBUG: aquiring cProc: targetRegion: " << targetRegion << ", cPid: " << coyote_proc->getCpid() << std::endl;
std::cerr << "ACLL DEBUG: aquiring cProc: targetRegion: " << targetRegion << ", cPid: " << coyote_proc->getCtid() << std::endl;
coyote_qProc_vec.erase(coyote_qProc_vec.begin() + i);
break;
}
}

if(coyote_proc == NULL || coyote_proc->getCpid() != 0){
if(coyote_proc == NULL || coyote_proc->getCtid() != 0){
std::cerr << "cProc initialization error!"<<std::endl;
for(unsigned int i = 0; i < coyote_qProc_vec.size(); i++) {
if(coyote_qProc_vec[i] != nullptr) {
Expand All @@ -308,7 +308,7 @@ CoyoteDevice::CoyoteDevice(unsigned int num_qp): num_qp(num_qp) {
}

for (unsigned int i=0; i<coyote_qProc_vec.size(); i++){
std::cerr << "ACLL DEBUG: aquiring qProc: targetRegion: " << targetRegion << ", cPid: " << coyote_qProc_vec[i]->getCpid() << std::endl;
std::cerr << "ACLL DEBUG: aquiring qProc: targetRegion: " << targetRegion << ", cPid: " << coyote_qProc_vec[i]->getCtid() << std::endl;
}

}
Expand Down Expand Up @@ -369,7 +369,7 @@ CCLO::deviceType CoyoteDevice::get_device_type()
void CoyoteDevice::printDebug(){
coyote_proc->printDebug();

std::ifstream inputFile("/sys/kernel/coyote_cnfg/cyt_attr_nstats_q0");
std::ifstream inputFile("/sys/kernel/coyote_sysfs_0/cyt_attr_nstats");

if (!inputFile.is_open()) {
std::cerr << "Failed to open net sts file." << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions kernels/plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#
# *******************************************************************************/

PERIPHERAL_IPS = hostctrl loopback reduce_ops hp_compression dummy_tcp_stack client_arbiter vadd_put cyt_adapter external_dma dummy_cyt_rdma_stack dummy_cyt_dma tcp_session_handler
DEVICE=xcu280-fsvh2892-2L-e
PERIPHERAL_IPS = hostctrl loopback reduce_ops hp_compression dummy_tcp_stack client_arbiter vadd_put cyt_adapter external_dma tcp_session_handler
DEVICE=xcu55c-fsvh2892-2L-e
TARGET=ip

all: $(PERIPHERAL_IPS)
Expand Down
17 changes: 11 additions & 6 deletions kernels/plugins/cyt_adapter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@
# *******************************************************************************/

TARGET=ip
DEVICE=xcu250-figd2104-2L-e
CYT_DMA_ADAPTER=cyt_dma_adapter_$(DEVICE).xo
DEVICE=xcu55c-fsvh2892-2L-e
CYT_DMA_SQ_ADAPTER=cyt_dma_sq_adapter_$(DEVICE).xo
CYT_RDMA_ARBITER=cyt_rdma_arbiter_$(DEVICE).xo
CYT_RDMA_MUX=cyt_rdma_mux_$(DEVICE).xo
CCLO_SQ_ADAPTER=cclo_sq_adapter_$(DEVICE).xo
CYT_CQ_DM_STS_CONVERTER=cyt_cq_dm_sts_converter_$(DEVICE).xo

all: $(CYT_DMA_ADAPTER) $(CYT_RDMA_ARBITER) $(CYT_RDMA_MUX)

$(CYT_DMA_ADAPTER): build_cyt_dma_adapter.tcl cyt_dma_adapter.cpp
all: $(CYT_RDMA_ARBITER) $(CCLO_SQ_ADAPTER) $(CYT_DMA_SQ_ADAPTER) $(CYT_CQ_DM_STS_CONVERTER)

$(CYT_CQ_DM_STS_CONVERTER): build_cyt_cq_dm_sts_converter.tcl cyt_cq_dm_sts_converter.cpp
vitis_hls $< -tclargs $(TARGET) $(DEVICE)

$(CYT_DMA_SQ_ADAPTER): build_cyt_dma_sq_adapter.tcl cyt_dma_sq_adapter.cpp
vitis_hls $< -tclargs $(TARGET) $(DEVICE)

$(CYT_RDMA_ARBITER): build_cyt_rdma_arbiter.tcl cyt_rdma_arbiter.cpp
vitis_hls $< -tclargs $(TARGET) $(DEVICE)

$(CYT_RDMA_MUX): build_cyt_rdma_mux.tcl cyt_rdma_mux.cpp
$(CCLO_SQ_ADAPTER): build_cclo_sq_adapter.tcl cclo_sq_adapter.cpp
vitis_hls $< -tclargs $(TARGET) $(DEVICE)

Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ switch $command {
}


open_project build_cyt_rdma_mux.${device}
open_project build_cclo_sq_adapter.${device}

add_files cclo_sq_adapter.cpp -cflags "-std=c++14 -I. -I../../cclo/hls/eth_intf -I../../../driver/hls/ -DACCL_SYNTHESIS"

add_files cyt_rdma_mux.cpp -cflags "-std=c++14 -I. -I../../cclo/hls/eth_intf -I../../../driver/hls/ -DACCL_SYNTHESIS"


set_top cyt_rdma_mux
set_top cclo_sq_adapter

open_solution sol1
config_export -format xo -library ACCL -output [pwd]/cyt_rdma_mux_${device}.xo
config_export -format xo -library ACCL -output [pwd]/cclo_sq_adapter_${device}.xo

if {$do_sim} {
csim_design -clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

set command [lindex $argv 0]
set device [lindex $argv 1]
set stack [lindex $argv 2]

set do_sim 0
set do_syn 0
Expand Down Expand Up @@ -52,19 +51,15 @@ switch $command {
}


open_project build_cyt_dma_adapter.${device}
open_project build_cyt_cq_dm_sts_converter.${device}

if {$stack eq "RDMA"} {
add_files cyt_dma_adapter.cpp -cflags "-std=c++14 -I. -I../../../driver/hls/ -DACCL_SYNTHESIS -DACCL_RDMA"
} else {
add_files cyt_dma_adapter.cpp -cflags "-std=c++14 -I. -I../../../driver/hls/ -DACCL_SYNTHESIS"
}
add_files cyt_cq_dm_sts_converter.cpp -cflags "-std=c++14 -I. -I../../cclo/hls/eth_intf -I../../../driver/hls/ -DACCL_SYNTHESIS"


set_top cyt_dma_adapter
set_top cyt_cq_dm_sts_converter

open_solution sol1
config_export -format xo -library ACCL -output [pwd]/cyt_dma_adapter_$device.xo
config_export -format xo -library ACCL -output [pwd]/cyt_cq_dm_sts_converter_${device}.xo

if {$do_sim} {
csim_design -clean
Expand Down
82 changes: 82 additions & 0 deletions kernels/plugins/cyt_adapter/build_cyt_dma_sq_adapter.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# /*******************************************************************************
# Copyright (C) 2023 Advanced Micro Devices, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# *******************************************************************************/

set command [lindex $argv 0]
set device [lindex $argv 1]

set do_sim 0
set do_syn 0
set do_export 0
set do_cosim 0

switch $command {
"sim" {
set do_sim 1
}
"syn" {
set do_syn 1
}
"ip" {
set do_syn 1
set do_export 1
}
"cosim" {
set do_syn 1
set do_cosim 1
}
"all" {
set do_sim 1
set do_syn 1
set do_export 1
set do_cosim 1
}
default {
puts "Unrecognized command"
exit
}
}


open_project build_cyt_dma_sq_adapter.${device}

add_files cyt_dma_sq_adapter.cpp -cflags "-std=c++14 -I. -I../../cclo/hls/eth_intf -I../../../driver/hls/ -DACCL_SYNTHESIS"


set_top cyt_dma_sq_adapter

open_solution sol1
config_export -format xo -library ACCL -output [pwd]/cyt_dma_sq_adapter_${device}.xo

if {$do_sim} {
csim_design -clean
}

if {$do_syn} {
set_part $device
create_clock -period 4 -name default
csynth_design
}

if {$do_export} {
export_design
}

if ${do_cosim} {
cosim_design
}

exit
Loading