Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into issue/HAST-314
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Sep 25, 2023
2 parents 9c25b9f + 49ab6d2 commit ee484bf
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [created]
issues:
types: [opened]
pull_request:
pull_request_target:
types: [opened]

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To begin working with Hastlayer you'll need the following:
- A .NET project that requires some hardware acceleration.
- A compatible FPGA board. You have the following options here:
- For production-level commercial workloads:
- Using [Xilinx Alveo U50, U200, U250 or U280 Data Center Accelerator Cards](https://www.xilinx.com/products/boards-and-kits/alveo.html) on-premises or in the cloud. In the cloud you can use them on Azure.
- Using [Xilinx Alveo U50, U200, U250 or U280 Data Center Accelerator Cards](https://www.xilinx.com/products/boards-and-kits/alveo.html) on-premises or in the cloud. In the cloud you can use them on Azure in [NP-series virtual machines](https://learn.microsoft.com/en-us/azure/virtual-machines/np-series).
- Using [AWS EC2 F1 instances](https://aws.amazon.com/ec2/instance-types/f1/).
- For embedded workloads: Using single board/module computers with Xilinx Zynq-7000 series SoC. We officially support the [Trenz Electronic TE0715-04-30-1C](https://shop.trenz-electronic.de/en/TE0715-04-30-1C-SoC-Module-with-Xilinx-Zynq-XC7Z030-1SBG485C-1-GByte-DDR3L-SDRAM-4-x-5-cm) module, but the codebase isn't highly specific to it and you can make your own manifest provider and device driver by inheriting from the same base classes.
- For simpler workloads and testing: The [Nexys A7 (formerly known as Nexys 4 DDR)](https://store.digilentinc.com/nexys-a7-fpga-trainer-board-recommended-for-ece-curriculum/) board (which is **NOT** the same as the non-DDR Nexys 4, be sure to purchase the linked board!) is suitable. The **Nexys A7-100T** version is required. Note that this is a relatively low-end development board that can't fit huge algorithms and it only supports slow communication channels. So with this board Hastlayer is only suitable for simpler algorithms that only need to exchange small amount of data. Note that to work with Nexys cards, you need to use the Hastlayer SDK from source.
Expand Down
2 changes: 1 addition & 1 deletion Docs/WorkingWithHastlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

You can add Hastlayer to your app from NuGet, and then get going, see the steps below. You can also check out a sample solution right away, in [the _NuGetTest_ folder of this repo](../NuGetTest).

1. Install the latest version of the `Hast.Layer` NuGet package.
1. Install the latest version of the [`Hast.Layer` NuGet package](https://www.nuget.org/packages/Hast.Layer/).
2. You'll need a hardware framework too; currently, there's only one, so also install the latest version of the `Hast.Vitis.HardwareFramework` NuGet package.
3. In the project where you want to use Hastlayer add the necessary initialization code (as shown in the samples).
4. You're ready to start working with Hastlayer! We suggest starting with the included samples then taking your first Hastlayer steps by writing some small algorithm, then gradually stepping up to more complex applications. You can check out all the samples in the _Samples_ solution folder of the SDK.
Expand Down
4 changes: 2 additions & 2 deletions NuGetTest/Hast.NuGet.Console/Hast.NuGet.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Hast.Algorithms" Version="2.1.0" />
<PackageReference Include="Hast.Layer" Version="2.1.0" />
<PackageReference Include="Hast.Algorithms" Version="2.1.1-alpha.0.hast-321" />
<PackageReference Include="Hast.Layer" Version="2.1.1-alpha.0.hast-321" />
<PackageReference Include="Hast.Vitis.HardwareFramework" Version="1.2.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ private void VerifyHardwareEntryPoints(SyntaxTree syntaxTree, ITypeDeclarationLo
{
var unsupportedMembers = type
.Members
.Where(member => member is FieldDeclaration || member is PropertyDeclaration || member.GetFullName().IsConstructorName());
.Where(member =>
(member is FieldDeclaration or PropertyDeclaration && !member.HasModifier(Modifiers.Const)) ||
member.GetFullName().IsConstructorName());
if (unsupportedMembers.Any())
{
throw new NotSupportedException(
Expand Down
8 changes: 4 additions & 4 deletions src/Hastlayer/Hast.Transformer/Models/IArraySizeHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public static IArraySize GetSizeOrThrow(this IArraySizeHolder arraySizeHolder, A
if (size == null)
{
throw new NotSupportedException(
"The length of the array holder " + arrayHolder.GetFullName() +
" couldn't be statically determined. Only arrays with dimensions defined at compile-time are " +
"supported. If the array size is actually static just Hastlayer can't figure it out for some " +
"reason then you can configure it manually via TransformerConfiguration.");
"The length of the array holder \"" + arrayHolder.GetFullName() + "\" couldn't be statically " +
"determined. Only arrays with dimensions defined at compile-time are supported. If the array size is " +
"actually static just Hastlayer can't figure it out for some reason then you can configure it " +
"manually via TransformerConfiguration by using the quoted full name.");
}

return size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ private void PassLengthOfArrayHolderToParent(AstNode arrayHolder, int arrayLengt
{
AssignmentHandler = assignmentExpression =>
{
// Only assignments where an array is assigned to another member/variable matters, not just any
// assignment where arrayHolder is on the right (excluding cases where e.g. the right side is a
// method call with an array as an argument).
if (assignmentExpression.Right != arrayHolder &&
assignmentExpression.Right is InvocationExpression invocationExpression &&
invocationExpression.Target != arrayHolder)
{
return;
}
if (assignmentExpression.Left is MemberReferenceExpression memberReferenceExpression)
{
_arraySizeHolder.SetSize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ protected override void VisitChildren(AstNode node)
}
}

// Is this a const? Then we can just substitute it directly.
// Is this a const expression? Then we can just substitute it directly.
var resolveResult = node.GetResolveResult();
if (resolveResult?.IsCompileTimeConstant == true &&
if (node is Expression &&
resolveResult?.IsCompileTimeConstant == true &&
resolveResult.ConstantValue != null &&
node is not PrimitiveExpression)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Hastlayer/Hast.Vitis/Docs/AzureReadme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using Hastlayer with Vitis boards on Azure NP Servers

If you want work with an Alveo card on an Azure VM, you need to pick the Azure-specific device (currently only `Azure Alveo U250`). This alters some of the automatic compilation steps. After compilation it submits your binary to an attestation server (via Azure Blob Storage) for automatic approval.
If you want work with an Alveo card on an [Azure NP-series VM](https://learn.microsoft.com/en-us/azure/virtual-machines/np-series), you need to pick the Azure-specific device (currently only `Azure Alveo U250`). This alters some of the automatic compilation steps. After compilation it submits your binary to an attestation server (via Azure Blob Storage) for automatic approval.

## Preparation

Expand Down
2 changes: 1 addition & 1 deletion src/Hastlayer/Hast.Vitis/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

This project contains the communication service used to connect with Xilinx's [Vitis Unified Software Platform](https://www.xilinx.com/products/design-tools/vitis/vitis-platform.html) devices, such as the [Xilinx Alveo U250](https://www.xilinx.com/products/boards-and-kits/alveo/u250.html) FPGA accelerator card via the [OpenCL](https://www.khronos.org/opencl/) library.
This project contains the communication service used to connect with Xilinx's [Vitis Unified Software Platform](https://www.xilinx.com/products/design-tools/vitis/vitis-platform.html) devices, such as the [Xilinx Alveo U250](https://www.xilinx.com/products/boards-and-kits/alveo/u250.html) FPGA accelerator card via the [OpenCL](https://www.khronos.org/opencl/) library. This includes [Azure NP-series virtual machines](https://learn.microsoft.com/en-us/azure/virtual-machines/np-series).

Note that the SH scripts in this project should use LF line endings! You'll get errors such as `-bash: $'\r': command not found` otherwise.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup Condition="$(SolutionName) == 'Hastlayer.SDK.NuGet'">
<PackageReference Include="Hast.Algorithms" Version="2.1.0" />
<PackageReference Include="Hast.Layer" Version="2.1.0" />
<PackageReference Include="Hast.Algorithms" Version="2.1.1-alpha.0.hast-321" />
<PackageReference Include="Hast.Layer" Version="2.1.1-alpha.0.hast-321" />
<PackageReference Include="Lombiq.Arithmetics" Version="0.0.1-alpha.3.hast-175" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ public class StaticTestInputAssembliesVerificationTests : VerificationTestFixtur
new[] { typeof(ArrayUsingCases).Assembly },
configuration =>
{
configuration.TransformerConfiguration().UseSimpleMemory = false;
var transformerConfiguration = configuration.TransformerConfiguration();
transformerConfiguration.UseSimpleMemory = false;
// This shouldn't be necessary: https://github.com/Lombiq/Hastlayer-SDK/issues/112.
transformerConfiguration.ArrayLengths.Add(
"System.Int32 Hast.TestInputs.Static.ArrayUsingCases+<>c::<PassArrayToTask>b__1_0(System.Object).arrayObject",
ArrayUsingCases.TaskArrayLength);
configuration
.TransformerConfiguration()
Expand Down
Loading

0 comments on commit ee484bf

Please sign in to comment.