Skip to content

Commit

Permalink
[ESI][Runtime][NFC] Cleanup runtime code (#6411)
Browse files Browse the repository at this point in the history
Mostly for internal consistency. Also remove some old, unused files.
  • Loading branch information
teqdruid authored Nov 10, 2023
1 parent 106b3a2 commit 5e31fb5
Show file tree
Hide file tree
Showing 15 changed files with 278 additions and 715 deletions.
38 changes: 24 additions & 14 deletions lib/Dialect/ESI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,45 @@ add_custom_target(esi-collateral)
set(ESI_RUNTIME_SRCS
ESIPrimitives.sv

runtime/CMakeLists.txt
runtime/cpp/include/esi/backends/Cosim.h
runtime/cpp/include/esi/backends/Trace.h
runtime/cpp/include/esi/Accelerator.h
runtime/cpp/include/esi/Design.h
runtime/cpp/include/esi/Manifest.h
runtime/cpp/include/esi/StdServices.h
runtime/cpp/include/esi/backends/Cosim.h
runtime/cpp/include/esi/backends/capnp.h
runtime/cpp/include/esi/esi.h
runtime/cpp/include/esi/Types.h
runtime/cpp/include/esi/Utils.h
runtime/cpp/lib/backends/Cosim.cpp
runtime/cpp/lib/backends/Trace.cpp
runtime/cpp/lib/Accelerator.cpp
runtime/cpp/lib/Design.cpp
runtime/cpp/lib/Manifest.cpp
runtime/cpp/lib/StdServices.cpp
runtime/cpp/lib/backends/Cosim.cpp
runtime/cpp/lib/Utils.cpp
runtime/cpp/tools/esiquery.cpp
runtime/python/esi/esiCppAccel.cpp
runtime/cosim/CMakeLists.txt
runtime/cosim/Cosim_DpiPkg.sv
runtime/cosim/Cosim_Endpoint.sv
runtime/cosim/Cosim_Manifest.sv
runtime/cosim/Cosim_MMIO.sv
runtime/cosim/MtiPliStub/CMakeLists.txt
runtime/cosim/MtiPliStub/DummySvDpi.cpp
runtime/cosim/cosim_dpi_server/CMakeLists.txt
runtime/cosim/cosim_dpi_server/DpiEntryPoints.cpp
runtime/cosim/cosim_dpi_server/Endpoint.cpp
runtime/cosim/cosim_dpi_server/DpiEntryPoints.cpp
runtime/cosim/cosim_dpi_server/Server.cpp
runtime/cosim/CosimDpi.capnp
runtime/cosim/include/cosim/dpi.h
runtime/cosim/include/cosim/Endpoint.h
runtime/cosim/include/cosim/LowLevel.h
runtime/cosim/include/cosim/Server.h
runtime/cosim/include/cosim/Utils.h
runtime/cosim/include/cosim/Endpoint.h
runtime/cosim/include/cosim/Server.h
runtime/cosim/include/cosim/dpi.h
runtime/cosim/include/dpi/svdpi.h
runtime/cosim/Cosim_Endpoint.sv
runtime/cosim/CosimDpi.capnp
runtime/cosim/Cosim_DpiPkg.sv
runtime/cosim/Cosim_Manifest.sv
runtime/python/esi/__init__.py
runtime/python/esi/accelerator.py
runtime/python/esi/esiCppAccel.cpp
runtime/python/esi/esiCppAccel.pyi
runtime/CMakeLists.txt
)

# A function which copies a file from the source tree to the build tree.
Expand Down
4 changes: 2 additions & 2 deletions lib/Dialect/ESI/runtime/cpp/include/esi/Accelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CustomService : public Service {
const HWClientDetails &clients);
virtual ~CustomService() = default;

virtual std::string getServiceSymbol() const { return _serviceSymbol; }
virtual std::string getServiceSymbol() const { return serviceSymbol; }

/// Request the host side channel ports for a particular instance (identified
/// by the AppID path). For convenience, provide the bundle type and direction
Expand All @@ -96,7 +96,7 @@ class CustomService : public Service {
BundlePort::Direction portDir) = 0;

private:
std::string _serviceSymbol;
std::string serviceSymbol;
};
} // namespace services

Expand Down
26 changes: 13 additions & 13 deletions lib/Dialect/ESI/runtime/cpp/include/esi/Design.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ class Design {
std::vector<std::unique_ptr<Instance>> children,
std::vector<services::Service *> services,
std::vector<BundlePort> ports)
: _info(info), _children(std::move(children)), _services(services),
_ports(ports) {}
: info(info), children(std::move(children)), services(services),
ports(ports) {}

std::optional<ModuleInfo> info() const { return _info; }
const std::vector<std::unique_ptr<Instance>> &children() const {
return _children;
std::optional<ModuleInfo> getInfo() const { return info; }
const std::vector<std::unique_ptr<Instance>> &getChildren() const {
return children;
}
const std::vector<BundlePort> &getPorts() const { return _ports; }
const std::vector<BundlePort> &getPorts() const { return ports; }

protected:
const std::optional<ModuleInfo> _info;
const std::vector<std::unique_ptr<Instance>> _children;
const std::vector<services::Service *> _services;
const std::vector<BundlePort> _ports;
const std::optional<ModuleInfo> info;
const std::vector<std::unique_ptr<Instance>> children;
const std::vector<services::Service *> services;
const std::vector<BundlePort> ports;
};

class Instance : public Design {
Expand All @@ -104,12 +104,12 @@ class Instance : public Design {
std::vector<std::unique_ptr<Instance>> children,
std::vector<services::Service *> services,
std::vector<BundlePort> ports)
: Design(info, std::move(children), services, ports), id_(id) {}
: Design(info, std::move(children), services, ports), id(id) {}

const AppID id() const { return id_; }
const AppID getID() const { return id; }

protected:
const AppID id_;
const AppID id;
};

} // namespace esi
Expand Down
12 changes: 6 additions & 6 deletions lib/Dialect/ESI/runtime/cpp/include/esi/Manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ using ServiceImplDetails = std::map<std::string, std::any>;
//===----------------------------------------------------------------------===//

// Forward declarations.
namespace internal {
class ManifestProxy;
} // namespace internal
namespace internal {} // namespace internal
class Accelerator;
class Design;

/// Class to parse a manifest. It also constructs the dynamic API for the
/// accelerator.
class Manifest {
public:
class Impl;

Manifest(const Manifest &) = delete;
Manifest(const std::string &jsonManifest);
~Manifest();

uint32_t apiVersion() const;
uint32_t getApiVersion() const;
// Modules which have designer specified metadata.
std::vector<ModuleInfo> moduleInfos() const;
std::vector<ModuleInfo> getModuleInfos() const;

// Build a dynamic design hierarchy from the manifest.
std::unique_ptr<Design> buildDesign(Accelerator &acc) const;
Expand All @@ -110,7 +110,7 @@ class Manifest {
const std::vector<std::reference_wrapper<const Type>> &getTypeTable() const;

private:
internal::ManifestProxy &manifest;
Impl &impl;
};

} // namespace esi
Expand Down
10 changes: 5 additions & 5 deletions lib/Dialect/ESI/runtime/cpp/include/esi/StdServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class SysInfo : public Service {
virtual std::string getServiceSymbol() const;

/// Get the ESI version number to check version compatibility.
virtual uint32_t esiVersion() const = 0;
virtual uint32_t getEsiVersion() const = 0;

/// Return the JSON-formatted system manifest.
virtual std::string jsonManifest() const;
virtual std::string getJsonManifest() const;

/// Return the zlib compressed JSON system manifest.
virtual std::vector<uint8_t> compressedManifest() const = 0;
virtual std::vector<uint8_t> getCompressedManifest() const = 0;
};

class MMIO : public Service {
Expand All @@ -58,10 +58,10 @@ class MMIOSysInfo final : public SysInfo {
MMIOSysInfo(const MMIO *);

/// Get the ESI version number to check version compatibility.
uint32_t esiVersion() const override;
uint32_t getEsiVersion() const override;

/// Return the zlib compressed JSON system manifest.
virtual std::vector<uint8_t> compressedManifest() const override;
virtual std::vector<uint8_t> getCompressedManifest() const override;

private:
const MMIO *mmio;
Expand Down
Loading

0 comments on commit 5e31fb5

Please sign in to comment.