esiaccel 0.1.5.dev104__cp312-cp312-win_amd64.whl → 0.1.5.dev109__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of esiaccel might be problematic. Click here for more details.

esiaccel/CosimBackend.dll CHANGED
Binary file
esiaccel/CosimBackend.lib CHANGED
Binary file
Binary file
Binary file
Binary file
esiaccel/MtiPli.dll CHANGED
Binary file
Binary file
esiaccel/esiquery.exe CHANGED
Binary file
@@ -20,6 +20,7 @@
20
20
  #include <cstdint>
21
21
  #include <map>
22
22
  #include <optional>
23
+ #include <span>
23
24
  #include <stdexcept>
24
25
  #include <string>
25
26
  #include <vector>
@@ -115,6 +116,11 @@ public:
115
116
  /// Get the data as a vector of bytes.
116
117
  const std::vector<uint8_t> &getData() const { return data; }
117
118
 
119
+ /// Implicit conversion to a vector/span of bytes, to play nice with other
120
+ /// APIs that accept bytearray-like things.
121
+ operator const std::vector<uint8_t> &() const { return data; }
122
+ operator std::span<const uint8_t>() const { return data; }
123
+
118
124
  /// Move the data out of this object.
119
125
  std::vector<uint8_t> takeData() { return std::move(data); }
120
126
 
@@ -271,13 +271,20 @@ public:
271
271
  void connect();
272
272
  std::future<MessageData> call(const MessageData &arg);
273
273
 
274
+ const esi::Type *getArgType() const {
275
+ return dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
276
+ ->getInner();
277
+ }
278
+
279
+ const esi::Type *getResultType() const {
280
+ return dynamic_cast<const ChannelType *>(
281
+ type->findChannel("result").first)
282
+ ->getInner();
283
+ }
284
+
274
285
  virtual std::optional<std::string> toString() const override {
275
- const esi::Type *argType =
276
- dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
277
- ->getInner();
278
- const esi::Type *resultType =
279
- dynamic_cast<const ChannelType *>(type->findChannel("result").first)
280
- ->getInner();
286
+ const esi::Type *argType = getArgType();
287
+ const esi::Type *resultType = getResultType();
281
288
  return "function " + resultType->getID() + "(" + argType->getID() + ")";
282
289
  }
283
290
 
@@ -320,13 +327,20 @@ public:
320
327
  void connect(std::function<MessageData(const MessageData &)> callback,
321
328
  bool quick = false);
322
329
 
330
+ const esi::Type *getArgType() const {
331
+ return dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
332
+ ->getInner();
333
+ }
334
+
335
+ const esi::Type *getResultType() const {
336
+ return dynamic_cast<const ChannelType *>(
337
+ type->findChannel("result").first)
338
+ ->getInner();
339
+ }
340
+
323
341
  virtual std::optional<std::string> toString() const override {
324
- const esi::Type *argType =
325
- dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
326
- ->getInner();
327
- const esi::Type *resultType =
328
- dynamic_cast<const ChannelType *>(type->findChannel("result").first)
329
- ->getInner();
342
+ const esi::Type *argType = getArgType();
343
+ const esi::Type *resultType = getResultType();
330
344
  return "callback " + resultType->getID() + "(" + argType->getID() + ")";
331
345
  }
332
346
 
@@ -16,11 +16,17 @@
16
16
  #ifndef ESI_TYPES_H
17
17
  #define ESI_TYPES_H
18
18
 
19
+ #include <algorithm>
20
+ #include <any>
19
21
  #include <cstdint>
20
22
  #include <map>
23
+ #include <span>
24
+ #include <stdexcept>
21
25
  #include <string>
22
26
  #include <vector>
23
27
 
28
+ #include "esi/Common.h"
29
+
24
30
  namespace esi {
25
31
 
26
32
  /// Root class of the ESI type system.
@@ -33,6 +39,37 @@ public:
33
39
  ID getID() const { return id; }
34
40
  virtual std::ptrdiff_t getBitWidth() const { return -1; }
35
41
 
42
+ /// Serialize an object to MessageData. The object should be passed as a
43
+ /// std::any to provide type erasure. Returns a MessageData containing the
44
+ /// serialized representation.
45
+ virtual MessageData serialize(const std::any &obj) const {
46
+ throw std::runtime_error("Serialization not implemented for type " + id);
47
+ }
48
+
49
+ /// Deserialize from a span of bytes to an object. Returns the deserialized
50
+ /// object as a std::any and a span to the remaining bytes.
51
+ virtual std::pair<std::any, std::span<const uint8_t>>
52
+ deserialize(std::span<const uint8_t> data) const {
53
+ throw std::runtime_error("Deserialization not implemented for type " + id);
54
+ }
55
+
56
+ /// Ensure that a std::any object is valid for this type. Throws
57
+ /// std::runtime_error if the object is not valid.
58
+ virtual void ensureValid(const std::any &obj) const {
59
+ throw std::runtime_error("Validation not implemented for type " + id);
60
+ }
61
+
62
+ // Check if a std::any object is valid for this type. Returns an optional
63
+ // error message if the object is not valid, else, std::nullopt.
64
+ std::optional<std::string> isValid(const std::any &obj) const {
65
+ try {
66
+ ensureValid(obj);
67
+ return std::nullopt;
68
+ } catch (const std::runtime_error &e) {
69
+ return e.what();
70
+ }
71
+ }
72
+
36
73
  protected:
37
74
  ID id;
38
75
  };
@@ -54,12 +91,7 @@ public:
54
91
  const ChannelVector &getChannels() const { return channels; }
55
92
  std::ptrdiff_t getBitWidth() const override { return -1; };
56
93
 
57
- std::pair<const Type *, Direction> findChannel(std::string name) const {
58
- for (auto [channelName, dir, type] : channels)
59
- if (channelName == name)
60
- return std::make_pair(type, dir);
61
- throw std::runtime_error("Channel '" + name + "' not found in bundle");
62
- }
94
+ std::pair<const Type *, Direction> findChannel(std::string name) const;
63
95
 
64
96
  protected:
65
97
  ChannelVector channels;
@@ -73,6 +105,11 @@ public:
73
105
  const Type *getInner() const { return inner; }
74
106
  std::ptrdiff_t getBitWidth() const override { return inner->getBitWidth(); };
75
107
 
108
+ void ensureValid(const std::any &obj) const override;
109
+ MessageData serialize(const std::any &obj) const override;
110
+ std::pair<std::any, std::span<const uint8_t>>
111
+ deserialize(std::span<const uint8_t> data) const override;
112
+
76
113
  private:
77
114
  const Type *inner;
78
115
  };
@@ -83,6 +120,11 @@ public:
83
120
  VoidType(const ID &id) : Type(id) {}
84
121
  // 'void' is 1 bit by convention.
85
122
  std::ptrdiff_t getBitWidth() const override { return 1; };
123
+
124
+ void ensureValid(const std::any &obj) const override;
125
+ MessageData serialize(const std::any &obj) const override;
126
+ std::pair<std::any, std::span<const uint8_t>>
127
+ deserialize(std::span<const uint8_t> data) const override;
86
128
  };
87
129
 
88
130
  /// The "any" type is a special type which can be used to represent any type, as
@@ -112,6 +154,11 @@ private:
112
154
  class BitsType : public BitVectorType {
113
155
  public:
114
156
  using BitVectorType::BitVectorType;
157
+
158
+ void ensureValid(const std::any &obj) const override;
159
+ MessageData serialize(const std::any &obj) const override;
160
+ std::pair<std::any, std::span<const uint8_t>>
161
+ deserialize(std::span<const uint8_t> data) const override;
115
162
  };
116
163
 
117
164
  /// Integers are bit vectors which may be signed or unsigned and are interpreted
@@ -125,12 +172,22 @@ public:
125
172
  class SIntType : public IntegerType {
126
173
  public:
127
174
  using IntegerType::IntegerType;
175
+
176
+ void ensureValid(const std::any &obj) const override;
177
+ MessageData serialize(const std::any &obj) const override;
178
+ std::pair<std::any, std::span<const uint8_t>>
179
+ deserialize(std::span<const uint8_t> data) const override;
128
180
  };
129
181
 
130
182
  /// Unsigned integer.
131
183
  class UIntType : public IntegerType {
132
184
  public:
133
185
  using IntegerType::IntegerType;
186
+
187
+ void ensureValid(const std::any &obj) const override;
188
+ MessageData serialize(const std::any &obj) const override;
189
+ std::pair<std::any, std::span<const uint8_t>>
190
+ deserialize(std::span<const uint8_t> data) const override;
134
191
  };
135
192
 
136
193
  /// Structs are an ordered collection of fields, each with a name and a type.
@@ -153,6 +210,11 @@ public:
153
210
  return size;
154
211
  }
155
212
 
213
+ void ensureValid(const std::any &obj) const override;
214
+ MessageData serialize(const std::any &obj) const override;
215
+ std::pair<std::any, std::span<const uint8_t>>
216
+ deserialize(std::span<const uint8_t> data) const override;
217
+
156
218
  // Returns whether this struct type should be reversed when
157
219
  // serializing/deserializing.
158
220
  // By default, a truthy value here makes StructType's compatible with system
@@ -180,6 +242,11 @@ public:
180
242
  return elementSize * size;
181
243
  }
182
244
 
245
+ void ensureValid(const std::any &obj) const override;
246
+ MessageData serialize(const std::any &obj) const override;
247
+ std::pair<std::any, std::span<const uint8_t>>
248
+ deserialize(std::span<const uint8_t> data) const override;
249
+
183
250
  private:
184
251
  const Type *elementType;
185
252
  uint64_t size;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esiaccel
3
- Version: 0.1.5.dev104
3
+ Version: 0.1.5.dev109
4
4
  Summary: ESI accelerators runtime
5
5
  Author-email: John Demme <John.Demme@microsoft.com>
6
6
  License: ==============================================================================
@@ -1,17 +1,17 @@
1
- esiaccel/CosimBackend.dll,sha256=RlSIvtBDE5dzjEF1jXUAx_gBNmU0SuluzFqzWpOC2SA,7150592
2
- esiaccel/CosimBackend.lib,sha256=LtcEhVi75BqE9pNbUTxOoSFvcjI954tz7VmdsBTaoLY,4991556
3
- esiaccel/ESICppRuntime.dll,sha256=uJlwV3UUIM0D1Lge2qT2a9ITPoGarMLmAH6IIhDwkrY,3722240
4
- esiaccel/ESICppRuntime.lib,sha256=jIEtwRR_6zJuM_eXeRTQYjBwp4CPp2ghYt9gGNQFwyU,14530126
5
- esiaccel/EsiCosimDpiServer.dll,sha256=T4URtspzmd2TU_6ZNGvOr_rrdA4JCBU8CSTvgLdy2TA,159744
1
+ esiaccel/CosimBackend.dll,sha256=-1oGeoxlOYFfyAvR1LHXgKJWiLCMlMe8tqSAeQTi1dw,7152128
2
+ esiaccel/CosimBackend.lib,sha256=UjflmgR93Kl22Du0lTqGhXWQqWEF-V8VwcqUuFo8GNk,4992924
3
+ esiaccel/ESICppRuntime.dll,sha256=opmZcZKYp0_9m_fFyHVG_iE4vGoBz3r_7vcSkw2tbEs,4072448
4
+ esiaccel/ESICppRuntime.lib,sha256=iTs8qJpIEH_7g-nMYZZGJbNrA1zekEwuTUAZfqUlmic,15139758
5
+ esiaccel/EsiCosimDpiServer.dll,sha256=HnJAX8hzB5xxfov1Lwf_ERLp556zDE58GUyjWU-dxN8,159744
6
6
  esiaccel/EsiCosimDpiServer.lib,sha256=bYBigD0RtRRSEiDxf4_gvpasLjD8fcUmC0CjRgQiQ0s,604164
7
- esiaccel/MtiPli.dll,sha256=xLnlKLEynXJbw8clNzNyWgVRPIQYLKjENsckwrrrCss,14848
7
+ esiaccel/MtiPli.dll,sha256=kDuEa8gesoGeIYw_oSksfyT_UcLNWH8_kZ3ZyTyYdHE,14848
8
8
  esiaccel/MtiPli.lib,sha256=X0PcXwheCUvBMgQ5BAawePxbXQSLNk5M1FFn6V56ydo,14570
9
9
  esiaccel/__init__.py,sha256=65xXWHwJwRePsyhWk837NpzuN0qsNhoAX29TOiSYKGc,905
10
10
  esiaccel/accelerator.py,sha256=BcXPsUqcQV3YsVVyYbz9P6JnZLlcnuageFbJwID9_3s,3318
11
11
  esiaccel/codegen.py,sha256=uoYELtnIabVvgLeCABj-mWras0BvmSKABPH-cd9nDFk,6560
12
12
  esiaccel/esi-cosim.py,sha256=GwYfNh4aagypheAhGf0EIX6ojkLYKkc5OMlFR9pfXe8,14381
13
- esiaccel/esiCppAccel.cp312-win_amd64.pyd,sha256=PYuBuXHkscH2NLrlFvoj_D7ccyMeXqXtSPUVRUcFyoU,507904
14
- esiaccel/esiquery.exe,sha256=7MhugVtsTGg4wEsdee7vZydWkJOBTQhGOmmYXioGWNs,441856
13
+ esiaccel/esiCppAccel.cp312-win_amd64.pyd,sha256=l9kElbUnVooP05MpHdqiibjuyWjAFwZnn3X5VNF1Rds,510976
14
+ esiaccel/esiquery.exe,sha256=k0Xxj_FLyuhBvWhWZpfA6bVQ1bNlARPULQrpUMF5DVA,441856
15
15
  esiaccel/types.py,sha256=LFLzUCvtYF6FLsmKet6eJTMq2ija2Z5kxd5Ks6tkS4U,19044
16
16
  esiaccel/utils.py,sha256=q-8fmgJ9tUvmBsIvqZiZ7u845IJhOjvjYTQLhhrNYl0,1515
17
17
  esiaccel/cmake/esiaccelConfig.cmake,sha256=u2aW99k1lEcmYTG1P3BTJqtmDrj53wUUaBz_jzw8kYY,565
@@ -22,22 +22,22 @@ esiaccel/cosim/driver.cpp,sha256=DrEKkSN7Y_Hu7wcaUulH5mbC2L4yB9xLClRMeRUpzHM,384
22
22
  esiaccel/cosim/driver.sv,sha256=ro-j9GM164A1W0MDPkqYfEn3TUKHSqVvgjO31fnloQI,1428
23
23
  esiaccel/include/esi/Accelerator.h,sha256=RhkZ2HeMZ0iHc5BkHdDWXoeg9J9lyPQciH5bWq5Qc_w,9772
24
24
  esiaccel/include/esi/CLI.h,sha256=Nn8tHn_xtEfkrD7USE2tao6ktYOJ6xcbnhZkS9-ox0A,2540
25
- esiaccel/include/esi/Common.h,sha256=pR2cqBEgKRYeJsHatjE7MC5WAw9SGbcO-JOyIGjIwF8,5503
25
+ esiaccel/include/esi/Common.h,sha256=IGJvAU72dlearXFbSmlXFFriy8aomirp7opEBjgewek,5775
26
26
  esiaccel/include/esi/Context.h,sha256=Tk_4nBDtTeVY62GfX4Cs_ZMIQstjSgrWHddN_PKANEA,2396
27
27
  esiaccel/include/esi/Design.h,sha256=mU8OwpCYijiWSdDq17l45LMzZxBca93nosudWCXNHfQ,4922
28
28
  esiaccel/include/esi/Engines.h,sha256=bbGbhXjYMpIpXh_DR0OS57zyGQUIDXh_S7xHX3su0Y0,4831
29
29
  esiaccel/include/esi/Logging.h,sha256=sHqMcpp0lNIHkIEyvSm-BBWx4zXXh6NOATCgZpgzYI4,8944
30
30
  esiaccel/include/esi/Manifest.h,sha256=j3v9UA0ogtJQBlv6k5s4j_3sCsq-gwF9btVg5dKTBlg,2244
31
31
  esiaccel/include/esi/Ports.h,sha256=T2WbPBViUSvFbO5Jjxlcp_eGq9jMitguvNnz3O0564U,10543
32
- esiaccel/include/esi/Services.h,sha256=H7Iq3F3LivSZHblFJmrC8RAU_MftfKAPDtyGBfJ2nP4,14815
33
- esiaccel/include/esi/Types.h,sha256=05nnhCXvStzCy436UM4LA6Z6N9jHgHUJgGcP5CWHQY0,5859
32
+ esiaccel/include/esi/Services.h,sha256=hv_asloGwIVcgoCjtYubfBvb-UJbU_GQKoZW464BYn8,15125
33
+ esiaccel/include/esi/Types.h,sha256=zAwdD24BtXFXMBNCkEy59pQ0r_NLM4GyxqIgjWuQ6ac,8675
34
34
  esiaccel/include/esi/Utils.h,sha256=KPd75GajIFeTBVJocXBjwsJqhbZg-ShWZCIe3oQdBss,3061
35
35
  esiaccel/include/esi/backends/Cosim.h,sha256=s7vYd0ra6m1nvk-n37MjvBoGVI-CCUKBt0DU4PKlaHM,2838
36
36
  esiaccel/include/esi/backends/RpcServer.h,sha256=WMwnhwU2qnrcglGNeiKg9QQHpkDx1QE1JydKYDK4jqE,1856
37
37
  esiaccel/include/esi/backends/Trace.h,sha256=kx4wwLH3a0ndmRUdaDyYGZ1SP83zlpFrk30Nw8ZrJJA,3286
38
- esiaccel-0.1.5.dev104.dist-info/licenses/LICENSE,sha256=vtnVnB8_lN1yPYcA5MeT56R8UsQtBhyzZLBvu_KMf7I,13468
39
- esiaccel-0.1.5.dev104.dist-info/METADATA,sha256=swcP5O3aZB-EDQxTAXzd7KNZDFebItz5aaHCmwicAMo,16148
40
- esiaccel-0.1.5.dev104.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
41
- esiaccel-0.1.5.dev104.dist-info/entry_points.txt,sha256=_CuNLV0fyTURxRREFwpzGycifZW_-7-MyuJNEwKK9J8,137
42
- esiaccel-0.1.5.dev104.dist-info/top_level.txt,sha256=fYWTWMDK4PDu4ePQ9NtcFHas2k8-d1kWhTs2avPpgB4,9
43
- esiaccel-0.1.5.dev104.dist-info/RECORD,,
38
+ esiaccel-0.1.5.dev109.dist-info/licenses/LICENSE,sha256=vtnVnB8_lN1yPYcA5MeT56R8UsQtBhyzZLBvu_KMf7I,13468
39
+ esiaccel-0.1.5.dev109.dist-info/METADATA,sha256=QuApKX402-OL_r3eLeumWbqiJCa8nnEt_k1h-0y97IE,16148
40
+ esiaccel-0.1.5.dev109.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
41
+ esiaccel-0.1.5.dev109.dist-info/entry_points.txt,sha256=_CuNLV0fyTURxRREFwpzGycifZW_-7-MyuJNEwKK9J8,137
42
+ esiaccel-0.1.5.dev109.dist-info/top_level.txt,sha256=fYWTWMDK4PDu4ePQ9NtcFHas2k8-d1kWhTs2avPpgB4,9
43
+ esiaccel-0.1.5.dev109.dist-info/RECORD,,