Пример #1
0
		private void Prepare(Program irprog)
		{
			Console.WriteLine("Kernels: " +
				string.Join("; ", irprog.Kernels.Select(krn => krn.Name)));
			Console.WriteLine("Subprograms: " +
				string.Join("; ", irprog.GetSubprograms().Except(irprog.Kernels).Select(sp => sp.Name)));

			program = irprog.ToGPUClProgram(device, context);

			clSafeCall(Cl.BuildProgram(program, 1, new[] { device }, string.Empty, null, IntPtr.Zero));
			Assert.AreEqual(Cl.BuildStatus.Success, Cl.GetProgramBuildInfo(program, device, Cl.ProgramBuildInfo.Status, out error).
				CastTo<Cl.BuildStatus>());
		}
Пример #2
0
		private void Prepare()
		{
			if (prepared)
				return;

			Program irprog = this.BuildIR();

			Console.WriteLine("Kernels: " +
				string.Join("; ", irprog.Kernels.Select(krn => krn.Name)));
			Console.WriteLine("Subprograms before inline: " +
				string.Join("; ", irprog.GetSubprograms().Except(irprog.Kernels).Select(sp => sp.Name)));			

			Program irprogInlined = irprog.InlineIR();

			Console.WriteLine("Subprograms after inline: " +
				string.Join("; ", irprogInlined.GetSubprograms().Except(irprogInlined.Kernels).Select(sp => sp.Name)));

			programInlined = irprogInlined.ToGPUClProgram(device, context);
			clSafeCall(Cl.BuildProgram(programInlined, 1, new[] { device }, string.Empty, null, IntPtr.Zero));
			Assert.AreEqual(Cl.BuildStatus.Success, Cl.GetProgramBuildInfo(programInlined, device, Cl.ProgramBuildInfo.Status, out error).
				CastTo<Cl.BuildStatus>());

			prepared = true;
		}