Commit Graph

92 Commits

Author SHA1 Message Date
hayodea 2c891bd2f3 Mrntt: Re-add exceptionInd
This now ensures that finalizeReq is indeed called from mrntt,
since exception-experiencing threads will post an exceptionInd
to mrntt, which will then call finalizeReq.
2025-11-23 03:27:18 -04:00
hayodea 27b43c6686 Add ComputeManager; add SmoHooks for getting ClDevices, buffers
We added a new centralized OpenCL Compute manager. This can later
be extended to support CUDA, SyCL, etc. SMO can be configured at
build time to choose which API it will use for compute.

Moreover, the ComputeMgr allows us to register buffers which are
available to all cl_contexts.
2025-11-19 22:34:25 -04:00
hayodea 457d0f9345 Dbg:Add CallableTracer for callables post()ed to boost.asio
This class and its macro allow us to trace the invocation of
callbacks as they're invoked by Boost.asio.
2025-11-06 21:45:16 -04:00
hayodea 5845f1a41d Bug:Boost: Use shlibs instead of header-only for call_stack::top_
This symbol is defined as a static member object inside of a
boost detail header. When boost headers are used in a project
that uses Boost in both the main binary as well as dlopen()'d
shlibs, the top_ symbol gets duplicated and the metadata gets
partitioned.

We use the Boost shlib to unify both the main binary and the
shlibs to use the same memory address for top_.

This involves marking the templated object call_stack::top_ as
"extern" and then declaring to Boost that we intend to use the
shlibs.
2025-11-03 22:59:52 -04:00
hayodea b277baa76d Whitespace 2025-10-23 00:24:57 -04:00
hayodea e444cd1e04 Move files around for cologex and sitbuff lib impl 2025-10-21 20:02:36 -04:00
hayodea 6bc5bd30d5 Rename: ChronoFrame=>PhenoFrame and ChronoSeq=>PhenoSeq 2025-10-21 19:38:49 -04:00
hayodea 56367402d7 Move intrinEventInd()s from MarionetteComponent=>Director 2025-10-21 19:38:49 -04:00
hayodea d1b99852a8 Move MarionetteComponent out of component.h=>marionette.h 2025-10-21 19:38:49 -04:00
hayodea 068a885bff Goal: now is a MentalEntity 2025-10-21 19:38:49 -04:00
latentprion edd223b083 Remove unnecessary componentThread.h #includes
Since componentThread #includes boost::asio components, removing
it should improve compile times.
2025-10-16 02:15:16 -04:00
latentprion 945c5b397b Build: remove superfluous io_service.hpp #includes 2025-10-16 01:08:05 -04:00
latentprion 5017bf5f92 Build: use piecemeal boost headers.
Reduces compile time on a 4-core ARM Rpi5 from 1m12s wallclock
(i.e: "real") time to 0m55s; and from 4m+ "user" time to 3m8s.
2025-10-16 01:00:48 -04:00
hayodea 95d5c46e43 Rename: CologexSet=>CologexSeq to be consistent with chronomena 2025-10-05 21:44:12 -04:00
hayodea 4a55ff9bf2 Revamp Chronomenon: ChronoFrame and ChronoSeq are new classes
Chronomenon is now the base class category for stored raw
stim data.
2025-10-05 21:44:12 -04:00
hayodea 27ff4a3a0a Concept,Cologex,Goal: refactor headers
All Cologexes (both Cologexes and CologexSets) are now categorized
as Concepts.
Goals are now also Concepts -- they inherit from Concept as a base
class.

Using Concept as the base class for both Cologex and CologexSet
allows us to treat both cologexes and cologexsets the same way
when comparing in the abstract.
2025-10-05 21:44:12 -04:00
hayodea eddee05e41 Delete: qualeBundle.h 2025-10-05 21:44:12 -04:00
hayodea ccc7fd8e04 Rename: Concept=>Cologex 2025-10-05 21:43:46 -04:00
hayodea eb5875fe0d Rename: Sense API => Stim Buff API 2025-10-01 20:03:47 -04:00
hayodea 06f3f2eebe DevMgr:attachAllUnattachedDevicesFromKnownListReq: acquire qutex
We should acquire the qutex here before iterating through the list
of DA specs.
2025-09-30 21:24:51 -04:00
hayodea 07609c6d6c SenseApiLib:Add isBeingDestroyed atomic flag for getter bailout
Since we have no choice but to access the sh_ptr<SenseApiLib> for
a lib before we can get its Qutex, we use this flag to ensure that
we can know whether the SenseApiLib data structure and its Qutex
are still valid when we enter -- i.e, we ensure that the SenseApiLib
object wasn't destroyed under our feet.
2025-09-30 21:01:00 -04:00
hayodea 77e123ff4a DevMgr:at/detachSenseDevReq: acquire SenseApiMgr qutex 2025-09-30 19:53:57 -04:00
hayodea 9c3a8ea695 Indentation 2025-09-30 19:51:50 -04:00
hayodea 0ff86a0a5e SenseApiMgr: Add Qutex 2025-09-30 19:51:01 -04:00
hayodea 97d93c670e Indentation 2025-09-30 01:15:30 -04:00
hayodea 9d77e8b345 SenseApiLib: Add qutex for lib state access serialization 2025-09-30 01:14:00 -04:00
hayodea cea65dcd00 Mrntt: Call initializeDeviceReattacher in init
It works surprisingly well on the first try.
2025-09-29 01:07:32 -04:00
hayodea bd52e49ba3 DevMgr: Add attachAllUnattachedDevicesFromKnownListReq
This function is the backbone for the DeviceReattacher daemon. It
assembles a list of all DA specs which are known to Mrntt, but which
haven't been successfully attached as yet, and attempts to attach
them.
2025-09-28 23:15:22 -04:00
hayodea 93103aa8d4 DevMgr: Add DeviceReattacher daemon plumbing
This is the plumbing for a periodic polling thread that tries
to reattach DA specs that failed to attach in the startup phase.
2025-09-28 23:07:39 -04:00
hayodea e45a9ee5d1 DAP.yy: use cmdlineDASpecs; DevMgr: add attachAllUnattachedDevicesFromCmdlineReq
This method wraps around attachAllUnattachedDevicesFromReq and supplies
it with a sh_ptr<> collection of all DASpecs parsed by the DAP parser
from the cmdline.

The initialization sequence now correctly initializes all DAP specs
given on the cmdline again.
2025-09-28 12:52:59 -04:00
hayodea b43ffcb677 DevMgr: attachAllUnattachedDevsFrom: now takes sh_ptr<vector<Spec>>
This method now accepts a sh_ptr<vector<DeviceAttachmentSpec>> to
tell it specifically which specs to attempt to attach.

This enables us to implement different frontends that supply it
with collections of devices from different sources (GUI, cmdline,
previously failed-to-attach/hot-removed devices, etc).

SMO temporarily initializes none of the devices from the cmdline
during this commit as we transition to implementing the cmdline
collection frontend.
2025-09-28 12:39:45 -04:00
hayodea 2c60248127 DevMgr: Rename at/detachAll*Req():
We've renamed these now to better reflect what they do.
* attachAllSenseDevicesFromSpecsReq=>attachAllUnattachedDevicesFromReq
* detachAllSenseDevicesReq=>detachAllAttachedDeviceRoles

This is also the first step in changing
attachAllUnattachedDevicesFrom to accept a sh_ptr<> to a collection
of DeviceAttachmentSpecs. This will enable us to unify the underlying
spec attachment logic and just create several front-ends for attaching
specs from multiple sources.
2025-09-28 12:19:56 -04:00
hayodea 993bf568fc DevMgr: implement removeDeviceAttachmentSpecReq
This reverts all state changes made by newDeviceAttachmentSpecInd.
2025-09-28 11:41:20 -04:00
hayodea 27e707a22d DevMgr:newDevAttSpecInd: take ref & not sh_ptr to DASpec
Because NewDevAttSpecInd should be the function that creates the
persistent sh_ptr state within DevMgr.
2025-09-28 11:14:55 -04:00
hayodea 572a8612ed DevMgr,Dev: Add Qutexes
Add Qutex locks to both DeviceManager and Device. These will be
properly used in the upcoming patches.
2025-09-28 01:27:32 -04:00
hayodea 51b70b179c DevMgr: call newDevAttSpecInd & not attDevReq in body:initReq
This performs a more complete device initialization and attachment
sequence. We'll do the corresponding teardown in the shutdown
sequence later.

We might probably do it as deviceRoleGoneAwayInd()
2025-09-28 01:15:36 -04:00
hayodea 1a56e2a107 DevMgr: Add DeviceRoles; attachedDevices unrelated to device state now
We've decided to add a separate notion of a DeviceRole to track attached
device roles now. We no longer use the collection of deviceSpecs to
track which roles have been attached. Rather, this list will simply
collate all known deviceAttachment specs which are expected to be
maintained in an attached state.

SMO can periodically scan through these and cross-reference this
collection with the collection of attachedDeviceRoles. Then it can
re-try to attach those which aren't currently attached at any given
moment. This will give resilience against device attachment failures
or device resets/malfunctions, at runtime.
2025-09-28 00:50:05 -04:00
hayodea e6b8d3e85d DevMgr: Move at/detachSenseDevs[FromSpecs] into DeviceMgr::
This is logically cleaner and it begins preparing our next set
of restructuring changes. To wit: we're revamping the device
manager to distinguish between devices and their roles.
2025-09-27 23:16:46 -04:00
hayodea 782bcd4567 Async: add sh_ptr<ContinuationChainLink> to Callback<>
This change enables us to finally implement the tracing of
continuations backward from the point of acquisition for deadlock
debugging.
2025-09-27 18:30:09 -04:00
hayodea 329d57a16d Formatting 2025-09-20 18:23:03 -04:00
hayodea af33b7f097 SenseApiMgr: Make at/detachSenseDev & at/detachAllSenseDevs posted
They are posted to Marionette.

* We also fixed callOriginCb invocations;
* Also made posted CBs use std::bind instead of greedily
  early-invoking the CB on the servicing thread's stack.
2025-09-16 18:38:06 -04:00
hayodea 674d74cfb9 DevMgr:newDevSpecInd: fix posting and async pattern conformance 2025-09-15 14:32:26 -04:00
hayodea b768739b96 CompThr: Delete shutdownInd & exceptionInd
We no longer need them because we now have
mrntt::mrntt.finalizeReq(), which does a more holistic job of
shutting down Marionette (and thus, ultimately, Salmanoff).
2025-09-15 13:43:11 -04:00
hayodea 472184bbbc Fix build errors with mind::globalMind and Qualia headers 2025-09-15 12:47:09 -04:00
hayodea d1e4c1a2ea Body:finalize: Will run if even one initReq step was executed
If even one step in Body.initializeReq was executed at all, then
whether or not it succeeded, we consider the body component to have
been initialized, at least with respect to whether finalizeReq
ought to run.
2025-09-15 08:30:17 -04:00
hayodea 0ec227cf9e Body:finalize: Run even if body.init wasn't called
We now run body.finalizeReq even if body.init wasn't called. We'll
do a finer-grained check on each aspect of Body that needs to be
finalized now. This check was too large-grained.
2025-09-15 08:23:54 -04:00
hayodea 91ccd16b33 Add Mrntt component; init globalMind in mrntt.initializeReq
This makes the initialization sequence much cleaner and conceptually
well encapsulated.

We also now dynamically allocate the Mind objects. They're allocated
dynamically by Mrntt inside of initializeReq. This means that we no
longer have to worry about jolting and cleaning up the running threads
of global mind object even when we never explicitly called
Mind.initializeReq.

Along with other conceptual improvements to our abstractions, this
patch also gets us to a real "end of program initialization" point
for the first time.
2025-09-14 22:17:19 -04:00
hayodea 16865dc36f Rename these files and change ifdef guards 2025-09-14 13:16:02 -04:00
hayodea da0ef64f62 Split CompThread=>MindThr+MrnttThr; alloc globalMind in mrnttMain
We now allocate globalMind locally inside of marionetteMain. Why?

Before now, we had an asymmetric threading situation where the
globalMind's threads were initialized at during global constructor
invocation and not on demand. This meant that we had to shut down
those threads even if we had never got to the point of calling
Mind::initializeReq.

This significantly complicated our shutdown sequence since we had
to factor in the lifetime of the std::thread objects inside of the
ComponentThreads which were inside of the globalMind object.

Now, if we hadn't called Mind::initializeReq, we don't have to
perform any Mind::finalizeReq or adjacent operations. Shutdown is
symmetrically mirrored against the operations we actually performed
during execution.

We introduced some complexity by splitting ComponentThreads into
two derivative types (MindThread and MarionetteThread) but I think
in the long term we'll be able to massage this split into a much
cleaner situation overall.
2025-09-14 11:07:05 -04:00
hayodea 1d3d929ddd Mind: Use state variables to manage shutdown
We now allow the shutdown*Req() methods of Mind:: to return early
if their aspect of the object in question hasn't actually been
initialized.
2025-09-13 18:59:44 -04:00