Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
90e4b61a
"vscode:/vscode.git/clone" did not exist on "57a8ccf3bafb87e40f62a88d927fcbd01de7eb4c"
Unverified
Commit
90e4b61a
authored
Jan 21, 2025
by
Jakob Görgen
Browse files
symphony/orchestration: allow simulation.NICSim to pass pci ant eth latencies separately
parent
313bcc7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
18 deletions
+29
-18
symphony/orchestration/simbricks/orchestration/simulation/base.py
.../orchestration/simbricks/orchestration/simulation/base.py
+5
-0
symphony/orchestration/simbricks/orchestration/simulation/pcidev.py
...rchestration/simbricks/orchestration/simulation/pcidev.py
+24
-18
No files found.
symphony/orchestration/simbricks/orchestration/simulation/base.py
View file @
90e4b61a
...
@@ -253,6 +253,11 @@ class Simulator(utils_base.IdObj, abc.ABC):
...
@@ -253,6 +253,11 @@ class Simulator(utils_base.IdObj, abc.ABC):
channels
.
append
(
channel
)
channels
.
append
(
channel
)
return
channels
return
channels
@
staticmethod
def
filter_channels_by_sys_type
(
channels
:
list
[
sim_chan
.
Channel
],
ty
:
type
[
T
])
->
list
[
T
]:
filtered
=
list
(
filter
(
lambda
chan
:
isinstance
(
chan
.
sys_channel
,
ty
),
channels
))
return
filtered
# pylint: disable=unused-argument
# pylint: disable=unused-argument
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
...
...
symphony/orchestration/simbricks/orchestration/simulation/pcidev.py
View file @
90e4b61a
...
@@ -34,26 +34,20 @@ from simbricks.orchestration.simulation import base as sim_base
...
@@ -34,26 +34,20 @@ from simbricks.orchestration.simulation import base as sim_base
class
PCIDevSim
(
sim_base
.
Simulator
):
class
PCIDevSim
(
sim_base
.
Simulator
):
"""Base class for PCIe device simulators."""
"""Base class for PCIe device simulators."""
def
__init__
(
def
__init__
(
self
,
simulation
:
sim_base
.
Simulation
,
executable
:
str
,
name
:
str
)
->
None
:
self
,
simulation
:
sim_base
.
Simulation
,
executable
:
str
,
name
:
str
)
->
None
:
super
().
__init__
(
simulation
=
simulation
,
executable
=
executable
,
name
=
name
)
super
().
__init__
(
simulation
=
simulation
,
executable
=
executable
,
name
=
name
)
def
full_name
(
self
)
->
str
:
def
full_name
(
self
)
->
str
:
return
"dev."
+
self
.
name
return
"dev."
+
self
.
name
def
supported_socket_types
(
def
supported_socket_types
(
self
,
interface
:
sys_base
.
Interface
)
->
set
[
inst_socket
.
SockType
]:
self
,
interface
:
sys_base
.
Interface
)
->
set
[
inst_socket
.
SockType
]:
return
{
inst_socket
.
SockType
.
LISTEN
}
return
{
inst_socket
.
SockType
.
LISTEN
}
class
NICSim
(
PCIDevSim
):
class
NICSim
(
PCIDevSim
):
"""Base class for NIC simulators."""
"""Base class for NIC simulators."""
def
__init__
(
def
__init__
(
self
,
simulation
:
sim_base
.
Simulation
,
executable
:
str
,
name
:
str
=
""
)
->
None
:
self
,
simulation
:
sim_base
.
Simulation
,
executable
:
str
,
name
:
str
=
""
)
->
None
:
super
().
__init__
(
simulation
=
simulation
,
executable
=
executable
,
name
=
name
)
super
().
__init__
(
simulation
=
simulation
,
executable
=
executable
,
name
=
name
)
def
full_name
(
self
)
->
str
:
def
full_name
(
self
)
->
str
:
...
@@ -65,10 +59,26 @@ class NICSim(PCIDevSim):
...
@@ -65,10 +59,26 @@ class NICSim(PCIDevSim):
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
channels
=
self
.
get_channels
()
channels
=
self
.
get_channels
()
latency
,
sync_period
,
run_sync
=
(
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
channels
=
channels
)
pci_channels
=
sim_base
.
Simulator
.
filter_channels_by_sys_type
(
channels
,
sys_pcie
.
PCIeChannel
)
pci_latency
,
pci_sync_period
,
pci_run_sync
=
(
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
pci_channels
)
)
)
eth_channels
=
sim_base
.
Simulator
.
filter_channels_by_sys_type
(
channels
,
sys_eth
.
EthChannel
)
eth_latency
,
eth_sync_period
,
eth_run_sync
=
(
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
eth_channels
)
)
if
eth_run_sync
!=
pci_run_sync
:
raise
Exception
(
"currently using different synchronization values for pci and eth is not supported"
)
run_sync
=
eth_run_sync
sync_period
=
min
(
pci_sync_period
,
eth_sync_period
)
cmd
=
f
"
{
inst
.
join_repo_base
(
relative_path
=
self
.
_executable
)
}
"
cmd
=
f
"
{
inst
.
join_repo_base
(
relative_path
=
self
.
_executable
)
}
"
nic_devices
=
self
.
filter_components_by_type
(
ty
=
sys_nic
.
SimplePCIeNIC
)
nic_devices
=
self
.
filter_components_by_type
(
ty
=
sys_nic
.
SimplePCIeNIC
)
...
@@ -85,7 +95,7 @@ class NICSim(PCIDevSim):
...
@@ -85,7 +95,7 @@ class NICSim(PCIDevSim):
cmd
+=
(
cmd
+=
(
f
"
{
inst
.
get_simulator_shm_pool_path
(
sim
=
self
)
}
{
int
(
run_sync
)
}
{
self
.
_start_tick
}
"
f
"
{
inst
.
get_simulator_shm_pool_path
(
sim
=
self
)
}
{
int
(
run_sync
)
}
{
self
.
_start_tick
}
"
f
"
{
sync_period
}
{
latency
}
{
latency
}
"
f
"
{
sync_period
}
{
pci_
latency
}
{
eth_
latency
}
"
)
)
# if self.mac is not None: # TODO: FIXME
# if self.mac is not None: # TODO: FIXME
...
@@ -131,9 +141,7 @@ class CorundumBMNICSim(NICSim):
...
@@ -131,9 +141,7 @@ class CorundumBMNICSim(NICSim):
return
json_obj
return
json_obj
@
classmethod
@
classmethod
def
fromJSON
(
def
fromJSON
(
cls
,
simulation
:
sim_base
.
Simulation
,
json_obj
:
dict
)
->
CorundumBMNICSim
:
cls
,
simulation
:
sim_base
.
Simulation
,
json_obj
:
dict
)
->
CorundumBMNICSim
:
return
super
().
fromJSON
(
simulation
,
json_obj
)
return
super
().
fromJSON
(
simulation
,
json_obj
)
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
...
@@ -161,9 +169,7 @@ class CorundumVerilatorNICSim(NICSim):
...
@@ -161,9 +169,7 @@ class CorundumVerilatorNICSim(NICSim):
return
json_obj
return
json_obj
@
classmethod
@
classmethod
def
fromJSON
(
def
fromJSON
(
cls
,
simulation
:
sim_base
.
Simulation
,
json_obj
:
dict
)
->
CorundumVerilatorNICSim
:
cls
,
simulation
:
sim_base
.
Simulation
,
json_obj
:
dict
)
->
CorundumVerilatorNICSim
:
return
super
().
fromJSON
(
simulation
,
json_obj
)
return
super
().
fromJSON
(
simulation
,
json_obj
)
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment